Cron Job Monitoring: How to Know When Your Scheduled Tasks Fail
Cron jobs fail silently. Backups don't run, reports don't send, data doesn't sync — and nobody notices for days. Here's how heartbeat monitoring fixes that.
Cron Job Monitoring: How to Know When Your Scheduled Tasks Fail
Here's a horror story that's far too common: your nightly database backup has been silently failing for three weeks. You only find out when you actually need to restore from backup — and there's nothing there.
Why Cron Jobs Are So Hard to Monitor
Traditional uptime monitoring checks whether a service is available. But cron jobs don't run continuously — they run on a schedule.
Failure modes:
- The job doesn't start (cron daemon died, server rebooted)
- The job starts but doesn't finish (hangs, runs out of memory)
- The job finishes but fails silently (returns exit code 0 despite errors)
- The job takes too long
- The job runs too frequently (duplicate execution)
The Solution: Heartbeat Monitoring
Instead of monitoring checking your job, your job checks in with monitoring.
#!/bin/bash
pg_dump mydb > /backups/daily.sql
curl -s https://monitor.example.com/heartbeat/abc123
If the ping doesn't arrive within the expected window, you get alerted.
What to Monitor with Heartbeats
| Job | Expected Interval | Grace Period |
|---|---|---|
| Database backup | 24 hours | 1 hour |
| Queue processor | 5 minutes | 2 minutes |
| Temp cleanup | 1 hour | 15 minutes |
| Weekly report | 7 days | 4 hours |
Advanced Patterns
- Start + End Pings — Detect jobs that start but hang
- Exit Code Reporting — Track success vs failure
- Duration Monitoring — Alert if a job takes longer than expected
- Output Logging — Send job output with the heartbeat for debugging
Two minutes of setup to prevent weeks of silent failures. Your cron jobs are running right now. Do you know if they're succeeding?
Written by
UptimeGuard Team
Related articles
Uptime Monitoring vs Observability: Do You Need Both?
Monitoring tells you something is broken. Observability tells you why. Understanding the difference helps you invest in the right tools at the right time.
Read moreMonitoring Stripe, PayPal, and Payment Gateways: Protect Your Revenue
Every minute your payment processing is down, you're losing real money. Here's exactly how to monitor payment gateways to catch failures before your revenue does.
Read moreWebhook Monitoring: Don't Let Failed Integrations Go Unnoticed
Webhooks power your integrations — payments, notifications, CI/CD. When they silently fail, data gets lost and workflows break. Here's how to keep them reliable.
Read more