Re: Log date



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







--
Mario Fréchette
Technicité
988 des Grives
Victoriaville
G6T1E8
819-740-0554
mario@xxxxxxxxxxxxx



--
ubuntu-users mailing list
ubuntu-users@xxxxxxxxxxxxxxxx
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users


Relevant Pages

  • Re: Log date
    ... that the sript runs but no date on the log file ... 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. ...
    (Ubuntu)
  • Re: cron job with pid: xxxx Failed
    ... Do the script write a log or are there outputs sent to /dev/null. ... If the answer is /dev/null change the entry to redirect the output to a file ... > the cron yesterday & came across this entry in the cron log file under ... > There is no other explanation in the log file as to why it failed. ...
    (comp.unix.admin)
  • Re: cron job with pid: xxxx Failed
    ... Do the script write a log or are there outputs sent to /dev/null. ... If the answer is /dev/null change the entry to redirect the output to a file ... > the cron yesterday & came across this entry in the cron log file under ... > There is no other explanation in the log file as to why it failed. ...
    (comp.unix.aix)
  • Re: cron job with pid: xxxx Failed
    ... > the cron yesterday & came across this entry in the cron log file ... You mention that no log file is created. ... the script called by cron. ... Permissions have chaned somewhere. ...
    (comp.unix.admin)
  • Re: cron job with pid: xxxx Failed
    ... > the cron yesterday & came across this entry in the cron log file ... You mention that no log file is created. ... the script called by cron. ... Permissions have chaned somewhere. ...
    (comp.unix.aix)