How to monitor
How to monitor a cron job
Cron jobs fail silently — the job stops, the server reboots, a deploy breaks the schedule, and nobody notices until data is missing. Here's how heartbeat monitoring catches it.
Cron jobs are the classic silent failure. Nothing pings you when a scheduled backup, billing run, or data sync stops happening — the job just quietly doesn't run. You find out days later when the backups are missing or the invoices never went out.
The fix is a heartbeat monitor (also called a dead man's switch): instead of checking whether a server is up, you check whether a job ran.
How heartbeat monitoring works
- You create a heartbeat monitor with an expected interval (e.g. "every 24 hours").
- Your job makes a quick outbound HTTPS request to a unique URL when it finishes successfully.
- If that ping doesn't arrive within the interval plus a grace period, the monitor trips and alerts you.
Because the job reaches out, it works anywhere with outbound internet — a private server, a container, a Kubernetes CronJob, or a serverless function.
Set it up in StatusCat
- Create a heartbeat monitor and set the expected interval to match your schedule.
- Set a grace period slightly longer than the job's normal run time, so a slow run doesn't false-alarm.
- Copy the ping URL StatusCat gives you.
- Ping it at the end of your job, only on success. A common pattern:
# Your nightly backup, then a success ping
/usr/local/bin/run-backup.sh && curl -fsS -m 10 https://statuscat.co/ping/your-unique-id > /dev/null
The && means the ping only fires if the backup exits successfully — so a failed backup won't check in, and you'll get alerted.
- Wire alerts to Slack, email or SMS so a missed run reaches the right person.
Good practices
- Ping on success only. Chaining with
&&turns "job failed" into "no heartbeat," which is exactly what you want to hear about. - One monitor per job. Don't share a heartbeat across jobs — you lose the ability to tell which one failed.
- Mind the grace period. Too tight and you get false alarms; too loose and you learn about failures late.
- Monitor the important ones: backups, billing, data syncs, queue workers, cleanup tasks, certificate renewals.
Heartbeats pair well with regular checks — see how to monitor an API and what uptime monitoring is. StatusCat includes heartbeat monitors alongside HTTP, TCP, DNS, SSL and keyword checks, free for 50 monitors.