How to disable e-mail notifications from a specific cron job

If you manage servers and use a lot the useful cron command, it can happen that you’ll find your e-mail spam folder full of messages from cron. So, let me explain to you how to prevent this case and how to disable e-mail notifications from a specific cron job.


No option in server control panel. Let’s redirect the output of the cron job

When a cron job is executed and the job runs (or fails), it will send an email to the root user.  A message with the output of a successfully executed cron job or with an error code will be sent via e-mail to the mail account of the administrator.

If you use a control panel like VestaCP, you can prevent the cron command to send e-mail but not for a specific cronjob. So, a nice solution is to silent (you can silence the output by adding the redirect) the cron command.

To disable e-mail notifications for a specific process of cron, you just need to append
> /dev/null 2>&1
to the command in the cron job. This redirects the output from the cron job to the /dev/null device.

For example:
*/5 * * * * lynx -source > /dev/null 2>&1