Linux: Disable Mail Alert From Cron Jobs

This post will guide you how to disable the mail alert by cron job command in Linux operating system. How do I stop cron sending mail for a specified cron job in CentOS/RHEL/Ubuntu Linux system. How to stop cron daemon from sending email for each cron job in linux. How can I stop all cron job email notification in Linux.

Disable Mail Alert From Cron Jobs


You can use the crontab command to update the crontab file for each user in Linux. and the output of all cron jobs will sent mail to the owner of the crontab file. by default, it will sent mail to the root user. If you want to stop receive all email output from the cron jobs. and you need to update the cronjob entry in /etc/crontab file.

You can redirect all output from cron jobs to /dev/null to disable mail alert for a particular cron jobs. just add any one of the following redirecting character at the end of the cron job.

>/dev/null 2>&1

Or

> /dev/null

Issue the following command to edit crontab file:

#crontab -e

Appending redirectring string to cron jobs:

1 3 * * * * /fio.sh >/dev/null 2>&1

Or

1 3 * * * * /fio.sh >/dev/null

save and close crontab file.

If you want to disable all email alert from cron jobs, you just need to update the MAILTO variable to a blank string. just like this:

MAILTO=""

You might also like:

Sidebar



back to top