Debian/Lenny - user cron jobs sending status e-mails
Some time ago I lost e-mail send capability on a remote server - probably when I upgraded to Lenny. Yesterday I finally got around to visiting it and got the capability back (the router has a dynamic IP address so I needed to find out what it was to connect remotely - I have a job on the server that had been e-mailing me when it changed).
Anyway, I'm now getting an e-mail message each time a cron job completes. Now I appreciate getting error messages sent to me, but is there a way I can turn off e-mail when a job terminates normally?
Specifically I have three jobs that are run as root through crontab (in addition to the anacron jobs Debian places there, which are also run as root). One runs hourly so I'm getting 24 e-mails a day telling me that it worked. The other two are run overnight once per day, so they are not so annoying but one already sends me e-mails when it fails, while the other I don't care if it succeeded or not.
It occurs to me that I left out some important details:
1) this is a new thing. It never used to happen
2) the sender is Cron Daemon <firstname.lastname@example.org>
3) the subject line is, for example,
Cron <root@dellbert> /root/check-ip.sh
where eol.ca is the isp handling mail from that server, dellbert is the server name and /root/check-ip.sh is the script cron runs every hour (the other two scripts give similar messages).
The body of the messages are any error messages that were generated, or some statistics (possibly from the router on the check-ip.sh script).
Located the source of the problem. My hourly job uses curl to log into the router (using a non-privileged account) and extract its current external ip address. Curl by default writes status information to the console, in addition to the output that goes to stdout. I suspect that the cron daemon is taking that as error information and sending me a notification. I've switched curl to operate in silent mode so that should take care of the problem.
Another script usually fails - that is what it should do - so I've removed it as not being necessary for now until I change it to not generate errors.
The third script actually did report a legitimate error that I've now addressed.
Hopefully the volume of e-mail from that server should decrease.
The devil is in the details, as usual ;)
Related note: A lot of the cron job scripts can use a log file instead of an email address. Cuts the email way down.
|All times are GMT -5. The time now is 09:55 PM.|