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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
01-11-2010, 11:36 AM
|
#1
|
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:
|
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
|
|
|
01-11-2010, 12:41 PM
|
#2
|
Member
Registered: May 2005
Distribution: spiral, fedora
Posts: 65
Rep:
|
Try logger. It's made for what you're trying to do.
Mike
|
|
|
01-11-2010, 12:46 PM
|
#3
|
Senior Member
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288
Rep:
|
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
|
|
|
01-11-2010, 06:25 PM
|
#4
|
Senior Member
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 2,127
Rep: 
|
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
|
|
|
All times are GMT -5. The time now is 02:35 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|