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.

StatusCat2 min read

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

  1. You create a heartbeat monitor with an expected interval (e.g. "every 24 hours").
  2. Your job makes a quick outbound HTTPS request to a unique URL when it finishes successfully.
  3. 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

  1. Create a heartbeat monitor and set the expected interval to match your schedule.
  2. Set a grace period slightly longer than the job's normal run time, so a slow run doesn't false-alarm.
  3. Copy the ping URL StatusCat gives you.
  4. 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.

  1. 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.

Frequently asked questions

What is a heartbeat monitor?
A heartbeat (or 'dead man's switch') monitor waits for your job to check in on a schedule. Instead of you pinging a server, your job pings the monitor when it finishes. If the expected ping doesn't arrive in time, you get alerted.
What grace period should I set?
Set the expected interval to your cron schedule, plus a grace period a bit longer than the job's normal run time. A nightly job that takes 10 minutes might use a 15–20 minute grace window so a slightly slow run doesn't false-alarm.
Can I monitor jobs on servers with no inbound access?
Yes — that's the point. The job makes an outbound HTTPS request to the monitor, so it works from cron on a private box, a Kubernetes CronJob, a serverless function, or anywhere with outbound internet.

Keep reading