How to disable the email alerts for a cronjob

There are 2 ways to prevent cron to send out e-mail notifications once the cron is executed:

01. Simply append one of the following directives to the end of your script to be executed.

so the cronjob will look like the following

* * * * * command /path/to/the/file >/dev/null 2>&1


* * * * * command /path/to/the/file &> /dev/null

Save and close the file. Restart the crond:

# /etc/init.d/crond restart


02. By editing the MAILTO variable in the cronjob

# crontab -e -u username


Save and close the file.

Tagged . Bookmark the permalink.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.