Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cron execution report

Status
Not open for further replies.

omasnjak

Technical User
Jun 1, 2008
13
0
0
CZ
Hi people,

Can you direct me what I have to do in order to make cron process to make some report that confirm that script is running really executed.

Kind regards,

Omasnajak
 
Cron can be set up to log. If you look at the manpage for cron, there should be some directions there.

I looked in my /var/log/cron.log and I see timestamps and the command that was run. If you are looking for something script specific, you may want to edit the script to make its own log file.
 
Doesn't cron send an email to the user executing the command by default?

I want to be good, is that not enough?
 
I know for any cron commands I add myself, that if I don't add > /dev/null after the command then it sends an E-Mail to root each time it executes with the results. I have root redirected to myself so I get those mails. Usually I leave it mail me until I'm comfortable everything is working right and then I suppress it, as I have better things to do than read cron E-mail. You might want to su yourself and check the root mail. Maybe the messages are laying in that mailbox. Or just cat /var/mail/root or wherever your system hides its mail.
 
I believe it only sends the mail if there is output back to the shell. Like an echo command or returned output from an ftp, or the like. If you run the script interactively and there's no output to the screen, I don't think any messages will be logged or e-mailed.

Of course, you could always add a line #echo "Completed" to your script at the end if it completes.

I usually set up sendmail and have all of root's mail forwarded to my "real" e-mail address.

I also found that if I don't end a PHP script with ?>, it will send the mail. Eliminating the end tag seemed to stop the mails. Donno why?

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top