Stop cron from emailing you junk when you only care about the errors

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

Stop cron from emailing you junk when you only care about the errors

🧩 The Challenge

Dealing with a mailbox full of “output from your job” emails is a nightmare when you’re looking for an actual failure. I’ve spent way too much time sifting through thousands of successful status updates just to find one real traceback.

💡 The Fix

Just redirect standard output to dev null while keeping standard error directed to the mailer. You’ll only get an email if the script actually throws an error.

* * * * * /usr/local/bin/backup-db.sh > /dev/null

⚙️ Why It Works

By sending stdout to the abyss, you effectively silence the noise of successful execution. Errors still pipe to your system mail because they remain untouched by the redirection, landing exactly where you can see them.

🚀 Pro-Tip: Use a dedicated error-logging wrapper if you need to keep a history of failed runs without spamming your inbox.

Linux Tips & Tricks | © ngelinux.com | 8/26/2026

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted