Stop getting blind-sided by failed cron jobs
Cron & Task Scheduling (Cron/Systemd Timers/At)
Stop getting blind-sided by failed cron jobs
🧩 The Challenge
Most of us write a script, toss it in crontab, and pray it actually runs when the clock hits zero. Then you find out three weeks later that a dependency path changed and the job has been failing silently since Tuesday.
💡 The Fix
Hook your cron jobs up to a simple health check service or use a basic mail wrapper so you get notified the second something goes pear-shaped. You shouldn’t have to go digging through syslog just to find out why a database backup didn’t fire.
0 * * * * /usr/local/bin/my-script.sh || echo "Job failed at $(date)" | mail -s "Cron Failure: MyScript" admin@example.com
⚙️ Why It Works
Adding the logical OR operator ensures that if your script exits with anything other than a zero, that mail command triggers instantly. It’s a low-effort way to add actual observability to your automation without setting up an entire monitoring stack.
🚀 Pro-Tip: If you hate cluttering your inbox, point those failures to a dedicated Slack webhook instead of email.
Linux Tips & Tricks | © ngelinux.com | 9/26/2026
