LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 01-11-2010, 11:36 AM   #1
davide123
Member
 
Registered: Jan 2010
Location: tampa bay fl
Distribution: fedora redhat 9 10 11 12 13 &14 x86_64 & i686; Peppermint, MintOne; RHEL 4 5 6, Ubuntu, SliTaz etc,
Posts: 102

Rep: Reputation: 16
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
 
Old 01-11-2010, 12:41 PM   #2
mjsurette
Member
 
Registered: May 2005
Distribution: aptosid
Posts: 55

Rep: Reputation: 18
Try logger. It's made for what you're trying to do.

Mike
 
Old 01-11-2010, 12:46 PM   #3
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
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
 
Old 01-11-2010, 06:25 PM   #4
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6 on my desktop, Ubuntu 12.04 LTS on my server, Ubuntu 12.04 on my netbook and the wife's PC
Posts: 1,192

Rep: Reputation: 96
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.

Last edited by taylorkh; 01-11-2010 at 06:25 PM. Reason: a little more info
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
log errors in cron job timl Red Hat 2 10-02-2009 03:09 AM
adding a perl script to cron.daily / cron.d to setup a cron job CrontabNewBIE Linux - Software 6 01-14-2008 08:16 AM
Cron Job: Start it Only once on specified time jCash Linux - Newbie 2 12-07-2007 07:35 PM
Cron job files by date Kumado Linux - General 4 04-26-2006 05:02 PM
Start Date + Time Duration = End Date/Time calculator? ToBe Linux - General 3 09-26-2005 10:17 AM


All times are GMT -5. The time now is 06:38 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration