Heartbeat and cron job monitoring

How heartbeat monitoring catches cron jobs that silently stop, and how to set the period and grace time.

Published 30 September 2026.

Most monitoring watches for errors. Heartbeat monitoring watches for absences. A backup, billing run, or queue worker pings a tool on success. If the ping stops, you get an alert. This pattern is also called a dead man's switch, cron monitoring, or check-in monitoring. It catches jobs that fail silently.

Why it is needed

Scheduled jobs fail quietly. The cron daemon may stop. A server replacement might miss the crontab copy. A job can exit early without an error. A container may never schedule. None of these produce an error to alert on. The only symptom is an absence. Only a heartbeat check notices absences.

How it works

  1. Create a check in a heartbeat tool to get a unique URL.
  2. Set the period for expected pings and the grace time to wait after a missed ping before alerting.
  3. Have the job call the URL on success.
  4. Alert when no ping arrives within period plus grace time.

A typical crontab line:

0 3 * * * /usr/local/bin/backup.sh && curl -fsS -m 10 --retry 3 https://heartbeat.example.com/ping/your-check-id

The && means the ping is only sent if the backup exits with status 0.

Setting period and grace time

  • Period matches the schedule. Use 24 hours for daily jobs. Use 5 minutes for jobs every 5 minutes. Some tools accept a cron expression directly. This handles complex schedules like "weekdays at 09:00".
  • Grace time covers normal variation. If a backup takes 20 to 40 minutes, set a grace time of an hour. This avoids false alerts. It still catches a job that never ran.

Beyond "did it run"

  • Start and finish pings. Ping at the start and at the end. The tool alerts when a job starts but never finishes. It also records how long each run took.
  • Failure pings. Some tools accept an explicit failure signal. A failing job alerts immediately. You do not wait for the grace time.
  • Exit codes and output. Some tools accept the exit code or the last lines of output with the ping. This saves a trip to the server to see why it failed.

Where heartbeats fit in escalation

A missed heartbeat is an alert like any other. Route it by job urgency. A missed nightly backup can wait for working hours. A stopped payment processor cannot. Send it to the right escalation policy accordingly.

Tools

The cron and heartbeat monitoring directory lists dedicated tools. Several are open source or offer free plans. Many uptime and on-call tools also include heartbeat checks. Filter the full directory by heartbeat to find them.