How to monitor cron jobs and backups with heartbeats
Oct 15, 2026 · 1 min read
Silent failures
Cron jobs, backups and queue workers don't have a URL you can check. When they stop, nothing happens — until you discover a week of missing backups.
The heartbeat pattern
Give each job a unique ping URL. At the end of every successful run, the job calls that URL:
0 3 * * * /usr/local/bin/backup.sh && curl -fsS https://status.example.com/api/ping/YOUR_TOKEN
If the ping doesn't arrive within the expected interval plus a grace period, you get an alert.
Report failures and duration
- Call
/startwhen the job begins and the normal URL when it ends to measure how long it takes. - Call
/failfrom your error handler to be alerted immediately.
Good practices
- Set the grace period a little longer than the job's normal run time.
- Use one heartbeat per job, so the alert tells you exactly what broke.
- Add heartbeats to your status page only for jobs customers care about.