View Categories

HOW TO DISABLE CRON EMAILS.

< 1 min read

Table of Contents

#

Disable cron emails using “>/dev/null 2>&1”

You can disable cron emails by adding >/dev/null 2>&1 to the end of each cron job line you wish to suppress. For example:

0 1 * * * yourcommand >/dev/null 2>&1

  • The >/dev/null tells the cron to send all output (STDOUT) to /dev/null
  • The 2>&1 tells the cron to send all errors (STDERR) to same as (STDOUT)

 

Using Mailto Option.

 

The default mailto value is root. You can disable the email notification for cronjob by setting MAILTO=””. You can also use the same variable to send cron emails to another specified email that is not root.

MAILTO=””
This disables cron emails

MAILTO=”[email protected]
This sends cron emails to a specified email.

Thank you for reading this tutorial.

Powered by BetterDocs

Leave A Reply

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

*