Heartbeat monitoring (a dead man's switch) for scheduled scripts
Heartbeat monitoring, also called a dead man's switch or push monitoring, turns the usual question around. Instead of checking whether a job failed, you expect it to check in on every run, and silence is the alarm. Below: how it works for cron jobs and scheduled scripts, what start and failure pings add, and how to choose the grace time.
How a dead man's switch works for jobs
Classic monitoring pulls: a server checks a website every minute and alerts when it doesn't answer. A scheduled script can't be checked that way, because between runs there is nothing to ask. So the job pushes instead:
- The monitor gets the schedule: "every day at 06:00", "every 15 minutes".
- Each run calls a unique URL when it finishes. That request is the heartbeat.
- If a heartbeat doesn't arrive by the expected time plus a grace period, the monitor alerts.
This catches the failures that leave nothing behind: a machine that was off, a crontab line that stopped matching after a change, a job that hangs forever, a cron service that didn't start after a reboot. It also needs nothing on the machine except the ability to make one HTTPS request. Services such as Healthchecks.io and TaskBeacon work this way; OnlineOrNot's cron monitoring guide (2026) describes the same pattern.
Start, failure and data: more than "it ran"
A bare heartbeat says only "a run ended". Three additions make it much more useful:
- A start ping (
/start) lets the monitor measure each run. A run that started and is taking far longer than usual turns Late while it is still hanging, instead of an hour later as Missed. - A failure ping (
/fail, or the exit code at the end of the URL) reports errors at once, with the message, instead of waiting for the grace time to run out. - Numbers such as
?rows=48210catch runs that ended "successfully" with no data. TaskBeacon alerts with Odd data when the rows drop more than 40% below recent runs or are 0.
A heartbeat for a cron job
For cron you don't have to touch the script. This crontab line sends a start ping, runs the job and reports its exit code at the end of the address (/0 is OK, any other number a failure):
# crontab -e (this example runs every day at 06:00)
0 6 * * * curl -fsS -m 10 https://taskbeacon.io/ping/your-job-id/start >/dev/null; /path/to/your-job.sh; curl -fsS -m 10 "https://taskbeacon.io/ping/your-job-id/$?" >/dev/nullIn the app, the Code tab of your job gives you this code with the job's own address instead of your-job-id, and you can untick the parts you don't need.
The line itself always exits with 0, because the last curl succeeds; TaskBeacon still records the failure. -m 10 caps each ping at 10 seconds, so a network problem never holds up the job. For Windows, use the PowerShell wrapper; for a script, the code for its language, such as Python, which also sends the error message.
Choosing the grace time
Grace is how long after the planned time a run may report before it counts as missed. Too tight and a slow night sends a false alarm; too loose and you hear about a real problem late. A good start is the job's usual duration plus a margin. After a few runs TaskBeacon suggests a grace that would have covered your real runs. See Grace.
Without a service
You can build a small dead man's switch yourself: each job touches a file or writes a row with a timestamp, and a separate checker (another cron job) alerts when a timestamp is older than expected. It works, but the checker has to run somewhere that stays up when the job's machine doesn't, it needs its own alerting, and nobody watches the checker. A hosted heartbeat service is that checker, run by someone else.
Connected Claude or ChatGPT to TaskBeacon? Ask it "what failed last night, and why?" and it answers from your jobs. How that works.
Related
In the Docs: Getting started · Grace · Linux cron.
- Find out when a scheduled job didn't run at allA run that never happened leaves no error to alert on.
- Get an alert when a Python cron job or scheduled script failscron reports output, not success or failure; Task Scheduler shows 0x1 to nobody.
- Check that last night's backup exists and isn't emptyThe backup ran; the file it made is 0 KB.
TaskBeacon is free to start, with every feature open for now and no credit card. Create a job, paste the code, and the first ping shows up on the job page.
Start free View live demoSources
- OnlineOrNot: Cron job monitoring guide (heartbeat pings explained) (updated 2026-03-03)
- Healthchecks.io docs: ping URLs, period and grace time (undated, © 2015–2026; checked 2026-11-09)
- man7.org: cron(8), cronie (page 2013, matches upstream cronie 2026)
Page checked against its sources on 2026-11-09. Menus and limits of other products change; if something here no longer matches, write to support@taskbeacon.io.