How to stop those darn Cron emails


How to stop Cron related emails ? The alert emails i.e. root@<your_domain> are generated when cron has trouble runnning a particular script or command.

Solution #1

To stop just a particular script or command output you simply need to redirect the output to /dev/null. This can be done as follows :-

Show Plain Text
Text code
  1. * * * * *   root    /path/to/your_script &> /dev/null
  2. or
  3. * * * * *   root    /path/to/your_script > /dev/null 2>&1

After editing cron should automatically re-read the /etc/crontab file but you can force the reload with :-

Show Plain Text
Text code
  1. /etc/init.d/cron restart

Solution #2

To stop all emails being sent by cron simply set MAILTO="" at the start of your /etc/crontab file.

Filed under: Linux  Tags: Debian, Ubuntu

0 Responses to “How to stop those darn Cron emails”

Sorry, comments have been closed for this post.