cron no longer sending emails
I have a quick question - cron used to send emails when any cron tasks/script was executed but just noticed that since a few days emails are not coming when cron runs. I can still send mailx emails from shell scripts though. But cron run per se isnt sending mails anymore. The mails used to come from "Cron Daemon root@
Any pointers please?
Thanks and regards,
Anshuman
3 Replies
I have some scripts which use mailx, if I run them manually they do send the email. So the mail system must be okay. However the emails which use to auto generate on cron runs have stopped. MAILTO variable is set properly too.
cat /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=
HOME=/
run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
Any pointers will be much appreciated.
Make sure everything is up-to-date, then search through the config files for your mail server to make sure it didn't rename/replace your config files. If you know the name of the config files you need to look at, the following command can speed things up:
updatedb && locate something.conf | grep etc
You'll need either mlocate or slocate installed to do that, though most systems have one of those installed by default.
Replace something.conf with the name of the config file. The "| grep" ([pipe character] grep) part will act as a filter for locate, and will only let the results show that have etc in them, which is useful for config files since most of them are in /etc.
Only look at the stuff for your mail server and cron. It's unlikely anything else will have broken cron's ability to send emails.