Site icon New Generation Enterprise Linux

Stop cron from sending you empty emails every time a job runs

Cron & Task Scheduling (Cron/Systemd Timers/At)

Stop cron from sending you empty emails every time a job runs

🧩 The Challenge

Setting up a quick cron job is great until your inbox gets slammed with useless status emails every single minute. I’ve spent way too much time deleting hundreds of blank messages because someone forgot to redirect stdout and stderr.

💡 The Fix

Just dump the output into the bit bucket using a simple redirect. You can still log errors if you want, but you have to be explicit about it.

* * * * * /usr/local/bin/backup.sh > /dev/null 2>&1

⚙️ Why It Works

Adding that bit to the end forces both standard output and standard error into /dev/null, which effectively deletes the noise before the MTA even looks at it. Cron only tries to mail you if the command produces output, so keeping it quiet kills the annoying emails dead.

🚀 Pro-Tip: If you actually need to debug a failing job later, change it to log to a file instead, like >> /var/log/myjob.log 2>&1.

Linux Tips & Tricks | © ngelinux.com | 7/23/2026

0 0 votes
Article Rating
Exit mobile version