+254725682556 +254725052660 [email protected]
Client Area

Hosting

How to Stop Cron Job Output Emails From Filling Your Inbox

If you've set up a cron job to run a script automatically, you may have noticed your inbox filling up with an email every single time it runs. This is expected behavior, not a bug: both cPanel and DirectAdmin are configured to email the account holder the output of every cron job by default. If the job runs every five or ten minutes, that can mean dozens of emails a day.

The fix is quick in either control panel. You have two options: stop the notification email entirely, or keep getting notified only when something actually goes wrong.

Why This Happens

A cron job is just a scheduled command. When it runs, the system captures anything the command prints out (its "output") and, unless told otherwise, mails that output to the address linked to the cron job. For a script that prints a status line or a database backup tool that logs progress, this adds up fast.

How to Stop the Emails

In cPanel

  1. Log in to your hosting control panel and open Cron Jobs under the Advanced section.
  2. Find the cron job you want to fix under Current Cron Jobs and click Edit, or scroll up to the Cron Email field at the top of the page.
  3. Clear out the email address in the Cron Email field and click Save Changes. With no address set, cPanel has nothing to mail the output to.

If you'd rather keep the notification setting but silence just one noisy job, edit that job's command instead and add >/dev/null 2>&1 to the end of it. This tells the server to discard the job's output instead of generating anything to email.

In DirectAdmin

  1. Log in to your control panel and open Cron Jobs.
  2. At the top of the page, find the Email Output (or similar notification) field and clear it, then click Save. This stops DirectAdmin from emailing output for your cron jobs.
  3. To silence only a specific job while leaving the rest as they are, edit that job's command and append >/dev/null 2>&1 to it, the same way as in cPanel.
If several unrelated scripts share one cron job email address, clearing that field turns off notifications for all of them at once. If you only want to quiet one noisy job, edit its command instead of the account-wide email field.

If You Still Want to Know When a Job Fails

Turning off all output isn't the only option. You can redirect normal output away while still catching errors, or save the output to a log file instead of your inbox:

  • Discard everything: add >/dev/null 2>&1 to the end of the command.
  • Log to a file instead of email: add >> /home/yourusername/cron.log 2>&1 (replace the path with one inside your account), which appends each run's output to that file so you can check it only when you need to.

For background on what a cron job actually is and how the scheduling fields work, see What Is a Cron Job and How Does It Work?.