Cron Only Email Errors

By | 2010/12/13

To have your trusty cron job only email errors, simply add this designation to the end of your cron entry:

 >/dev/null 

Example:

*/30 * * * * /usr/local/bin/myscript.pl >/dev/null


Optional more geeky details:

There are two different kinds of output from any given command.

“>” is the same as issuing “1>” which is the non-error output. This is being sent to /dev/null in the above example.

“2>” is the “error” output. Leaving this out of your crontab entry as above means it is processed as normal (2> output is emailed to you).