How to disable cron job mailing to root user

You are still receiving emails probably because you have only redirected standard output to /dev/null. Your shell script probably writes to stderr too, so correct redirection would be like:

* * * * * root /bin/apache2-restart.sh > /dev/null 2>&1

Insert MAILTO="" before you crontab line.


why don't you set MAILTO="" in particular user's here 'root' crontab. This will disable logging of mail messages in /var/spool/mail/


You have redirected outputs to /dev/null, but only if you're using bash as your crontab shell. I believe that by default you'd be using /bin/sh.

To fix it, I'd recommend thor's solution:

* * * * * root /bin/apache2-restart.sh > /dev/null 2>&1

The other solution is to change CRON to use bash by putting this at the beginning of your crontab entry:

SHELL=/bin/bash