Stop Crontab from Sending Emails

This week I was starting to get fed up with Crontab and it always sending me emails regarding jobs. I have log files setup and prefer to look at my logs for errors vs crontab flooding my inbox. I never can seem to remember the 2>&1 trick, as I do not constantly use crontab. So I went exploring in the manual and found a nice little track to stop crontab from flooding your sever mail file with mail. Simply put MAILTO='' at the top of your crontab and you are set. No more trying to remember the tricky 2>&1 or any other weird hacks. The MAILTO is simple to remember and just makes sense. On the flip side, if you want your crontab mail to goto a different email address, simply add the email address inside that variable.

No Comments

Leave us a comment

No comment posted yet.

Leave a Comment