Why it exists
Scheduled jobs fail by not happening, and a missing run leaves no error to catch. Backups, imports, report emails, subscription renewals and cache jobs are typical. A heartbeat also works for jobs the monitor cannot reach, such as those behind a firewall.
Setting it up
Choose the period (how often the job runs) and a grace time longer than the job’s normal run time and jitter. Send the signal only after the work has succeeded, for instance with job && curl .... Keep the URL secret and send alerts to a person.
A WordPress note
WP-Cron runs on page loads, not on a clock, so tasks on low-traffic sites can run late. A heartbeat shows the delay.
An example
At the end of a backup script: curl -fsS -m 10 --retry 3 https://monitor.example/hb/TOKEN. Many services also accept a start signal and a failure signal: the start records how long the run took, and the failure signal alerts at once instead of after the grace time. For a nightly job that takes about 10 minutes, a period of 24 hours and a grace time of 30 minutes means an alert half an hour after the expected time if nothing arrives.
What to check
That every important job has a heartbeat, that a missing signal reaches a person and that a restore, not only a run, is tested.
Sources
Read on . Standards and vendor pages change; confirm the current text before you rely on it.
- WordPress Plugin Handbook, Cron (developer.wordpress.org)