How can I stop cron from emailing me the results of jobs I schedule?


By setting the environment variable "MAILTO" as ""

Somethig like:


01 * * * *  /your/path/to/script/here.sh
  • This didn't work for SpamAssassin /etc/cron.d/sa-update. It still emailed me the errors. – Chloe Aug 31 '20 at 20:38

If you want a single job to stop email you simply append >/dev/null 2>&1 to it

For example:

0 * * * * /home/script >/dev/null 2>&1
  • 1
    If you are sure that one run will finish before the next starts, it can be worth redirecting the output to a named file rather than to /dev/null: that does give the option of checking what happened to the last run if you suspect a problem. – mas Jul 18 '09 at 19:02

Cron only emails you if there is output, either on stdout or stderr.

If it's script you've written, make it less verbose - remove unnecessary echo or print statements. Redirecting stdout to /dev/null is also a valid solution:

2 * * * * /my/script > /dev/null

If you still get messages after doing that, then the output is on stderr, thus it should be an error, which you should resolve.. If not, you can redirect stderr to /dev/null with..

2 * * * * /my/script > /dev/null 2> /dev/null

..although disregarding error messages is generally a bad idea! (How will you know when the cron job is broken?)

You could redirect a specific command's output from stderr to stdout using 2>&1 - for example:

command_which_prints_messages_to_stderr 2>&1 # redirect stderr to stdout

..then direct stdout to /dev/null in your cron job - that way you silence the loud command, without losing error messages

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.