Cron Daemon Email Spam

I had a Cron Job on one of our servers here just start spamming my email the week. It was basically a cron I set up every half hour to rotate some fast moving apache logs. Anyway, long story short, this cron just started emailing me every 30 minutes every time the job ran.

The easiest thing to do for a situation like this, is just to add to add > /dev/null 2>&1 to the end of your file in crontab (cron.d, cron.weekly, whatever).

5 0 * * * root /scripts/backup_test > /dev/null 2>&1

Of course, the better thing to do would be to find any issues in your email as it usually prints the output of the job. But in some cases, I don’t care. I set this script up to email me when it finishes successfully and if it doesn’t run, I get another email.