Detecting Stale Cron Executions with Systemd Log Watch
Cron & Task Scheduling (Cron/Systemd Timers/At)
Detecting Stale Cron Executions with Systemd Log Watch
🧩 The Challenge
Cron jobs often fail silently, leaving administrators unaware that critical background maintenance tasks have stopped executing. Relying on basic log files is cumbersome when you need to monitor the execution state of specific cron patterns across a fleet.
💡 The Fix
Use the journalctl utility to filter the system log specifically for cron-related service entries to verify recent execution timestamps and status codes.
journalctl -u cron.service --since "1 hour ago" --no-pager
⚙️ Why It Works
By querying the systemd journal for the cron service unit, you can instantly see the exact timestamps and exit codes for all tasks triggered in the last hour.
🚀 Pro-Tip: Use the -f flag to follow the cron log output in real-time while you manually trigger a script to verify your syntax and environment variables.
Linux Tips & Tricks | © ngelinux.com | 7/11/2026
