Cron Only Email Errors

Published on December 13, 2010, by in linux, sysadmin.



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).

Related posts:

  1. Repair /etc/passwd and /etc/group

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Notify me of followup comments via e-mail. You can also subscribe without commenting.

Home linux Cron Only Email Errors
© Copyleft scottlinux.com CC BY-SA 3.0