Stop your cron jobs from sending empty mail to root

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

Stop your cron jobs from sending empty mail to root

🧩 The Challenge

Setting up a cron job is easy, but watching /var/mail/root fill up with useless empty notifications every five minutes is a nightmare. I once spent an entire morning clearing out gigabytes of junk emails because I forgot a single redirection.

💡 The Fix

Silence the noise by redirecting stdout and stderr directly into the bit bucket. It saves your inbox and keeps the logs clean unless something actually breaks.

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

⚙️ Why It Works

Redirecting standard output to /dev/null kills the success messages, while the 2>&1 bit forces error messages into that same black hole.

🚀 Pro-Tip: If you need to debug later, redirect to a local log file instead so you can actually read the output.

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

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Newest
Oldest Most Voted