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

or

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

Save and close the file. Restart the crond:

# /etc/init.d/crond restart

Or

02. By editing the MAILTO variable in the cronjob

# crontab -e -u username

MAILTO=””

Save and close the file.

Tagged . Bookmark the permalink.

Leave a Reply