The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Adding a date as a first column figaro UNIX for Dummies Questions & Answers 2 05-21-2008 05:00 PM
adding or subtracting days in the o/p of date St.Fartatric UNIX for Dummies Questions & Answers 1 05-19-2008 07:10 AM
Grabing Date from filename and adding to the end of each line in the file. rkumar28 Shell Programming and Scripting 1 05-01-2007 08:25 PM
Formatting Date (adding a month) devid UNIX for Dummies Questions & Answers 4 01-18-2006 10:31 AM
Adding command line env in cron env abhijeetkul Shell Programming and Scripting 1 12-13-2005 09:42 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-18-2006
JohnH JohnH is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 2
adding date to cron log

Hi. I'm trying to output the current date to a cronjob log file. Nothing seems to work, echo $(date), echo `date` or just date in the script. I'm using /sbin/sh

Any ideas? Thanks, John
  #2 (permalink)  
Old 09-18-2006
badg3r badg3r is offline
Registered User
  
 

Join Date: May 2006
Posts: 12
The below works to make the logfile from a cron entry date specific:

00 11 * * * /scripts/scriptname.sh > /logs/log`date +%d%m%y`.log 2>&1

Or in the script:

DATE_STAMP=` date +%Y%m%d`

echo ${DATE_STAMP}

--------------

FILE_NAME=file_${DATE_STAMP}.log

do something > $FILE_NAME
  #3 (permalink)  
Old 09-18-2006
JohnH JohnH is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 2
Thanks. Actually, all of these work along with echo $(date) etc. The problem seems to be that the date echo is being overwritten by an stty error in the .profile which is being called next...
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 05:16 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0