LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how do i log the start/completion (time&date) of my cron job script? (http://www.linuxquestions.org/questions/linux-newbie-8/how-do-i-log-the-start-completion-time-and-date-of-my-cron-job-script-781496/)

davide123 01-11-2010 12:36 PM

how do i log the start/completion (time&date) of my cron job script?
 
how do i log the start/completion (time&date) of my cron job script?

i want to be able to see what time it started and what time it finished? and if there where any errors while running my script

thanks
davide

mjsurette 01-11-2010 01:41 PM

Try logger. It's made for what you're trying to do.

Mike

forrestt 01-11-2010 01:46 PM

You could also put the "date" command at the top and bottom of your script. Any output from you script should be emailed to the user it is run as. If you want to send it to a different address include a line similar to, "MAILTO=user@example.com" in your crontab file.

HTH

Forrest

taylorkh 01-11-2010 07:25 PM

I have generally written a log file to keep track of the performance of my scripts. For example
Quote:

echo Starting data mirror >> /quitelarge/_mirror/mirror.log
echo $(date +%y/%m/%d_%r) >> /quitelarge/_mirror/mirror.log
I also write and entry to the log when major milestones in the process complete - same syntax.

Hope this helps.

Ken

p.s. these lines are included in the shell script which would be executed by cron.


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