cron log
hi guys, how to check cron logs whether the command run success fully or not?
|
usually the user will get a mail about the output generated by the job (including stderr). Otherwise you have to modify your script to generate log.
|
if let's say had run this command:
less /var/log/messages | grep cron and the crontab was scheduled to run at 3am everyday, the log messages should also display 3am? or what time it should display? thanks. |
no, that will not work, crontab will not write anything in /var/log/messages.
the user can check his mails, in case of error cron will try to send the error message. Otherwise you need to implement some logging: * * * * * /this/is/my/srcipt > /tmp/cron.script.log 2>/tmp/cron.script.log2 also you can add echo "message" > /tmp/some/log/file into the script and you can see what's happening you can start your script with set -x. |
Command line options when starting Dillon's cron (a.k.a. dcron) daemon can generate log messages at various levels including info. It can similarly be made to log to a named log file.
IDK about Vixie (a.k.a ISC) cron. The bottom of the cron (or crond) man page usually states which of the two cron versions it applies to. |
Hi guys, thanks for your replies.
I had this on my crontab but it's not sending mail: MAILTO="myemail@mine.com" 0 3 * * 1-5 find /home/mybackupfolder -depth | cpio --create --format=crc > /dev/st0 any ideas why it's not sending? Thanks. |
Quote:
There's no working MTA to send the mail? |
Quote:
but if i used mail -s "Subject:Test" myemail@mytestmail.com my message . EOT i will be able to receive the email, is my crontab settings correct on my post above. thanks. |
this is not the crontab, but the mail settings
you can write a test crontab like (adjust time): 12 12 * * * echo asdfasdf and see if you get a mail |
hi pan64, i got it already i just modified the crontab and i'm able to get the mail.
0 3 * * 1-5 tar -czf /dev/st0 /home/mybackupfolder | mail -s "Success" myemail@mybackup.com thanks for all your help guys :) |
All times are GMT -5. The time now is 01:07 AM. |