Stop cron from dumping emails you never read

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

Stop cron from dumping emails you never read

🧩 The Challenge

Dealing with a server where cron keeps trying to send local mail for every single job output is a nightmare. Usually, you end up with a massive var spool file that eats disk space while you completely ignore the actual error logs.

💡 The Fix

Just redirect the output directly to dev null in your crontab line. It keeps your logs clean and stops your local mail spool from ballooning into a disaster.

* * * * * /path/to/script.sh > /dev/null 2>&1

⚙️ Why It Works

Adding the redirect handles both standard output and standard error, forcing the system to throw that noise away instead of trying to pipe it through the sendmail binary.

🚀 Pro-Tip: If you actually need the logs, use >> /var/log/myjob.log 2>&1 instead so you can rotate them properly.

Linux Tips & Tricks | © ngelinux.com | 12/1/2026

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted