Log date

Mario Frechette mario at technicite.ca
Thu Mar 27 19:13:42 UTC 2008

Nils Kassube a écrit :
> Mario Frechette wrote:
>> I am trying to get a date in my log file name for a script that runs
>> daily in cron and  i can see in syslog
>> that the sript runs but no date on the log file
>> this is how it looks in crontab
>> 43 12  *   *   1-5   /bin sh rsync.sh >/home/eric/backup.log.`date
>> "+%d%m%y"`
>> should I put some commands in the script itself ?
> It seems you can't use the "`" syntax because a crontab is not a script. 
> If you had installed the mail command, you would have received a mail 
> with the problem every time cron failed to execute your command. 
> Therefore, the log should be generated by your script. Another option 
> would be to install the mail command (e.g. package mailx). Then you would 
> receive the output of the script as a mail.
> Nils
thanks for the mail command tip i will use it

but what I would like is  to create a log file with a date in the name 
of the file that would look like  ( backup.log.`date +%d%m%y`) format or 
anything near that
 I succeded to create a file named backup.log in the /home DIR

but  how to do that in a bash script ?


Mario Fréchette
988 des Grives
mario at technicite.ca

More information about the ubuntu-users mailing list