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
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
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
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...