Stop chasing ghosts when your cron jobs fail silently
Cron & Task Scheduling (Cron/Systemd Timers/At)
Stop chasing ghosts when your cron jobs fail silently
🧩 The Challenge
Everyone thinks cron is set-and-forget until you find out a script hasn’t run for three days because the environment path was wrong. You end up digging through syslog just to see the job actually triggered, which tells you absolutely nothing about why it exited with status 1.
💡 The Fix
Start redirecting your cron output to a dedicated log file and use a simple wrapper to capture both stdout and stderr. You’ll stop guessing if the script ran and actually see the error message instead.
* * * * * /usr/local/bin/backup_script.sh >> /var/log/my_cron.log 2>&1
⚙️ Why It Works
Adding that 2>&1 bit redirects the error stream right into your standard log so the full failure trace is waiting for you in the morning. It keeps things dead simple without needing to configure complex mail transport agents that nobody maintains anyway.
🚀 Pro-Tip: Append a timestamp inside your script with logger or date if you want to know exactly when the execution bombed out.
Linux Tips & Tricks | © ngelinux.com | 11/27/2026
