Monitor cron jobs and backups with a heartbeat URL
Updated 2026-10-08
A cron job that stops running makes no noise. The server was rebuilt, the crontab line was lost, the disk filled up, or the script now exits early. You find out weeks later, when you need the backup. Error emails don't help here, because a job that never starts never sends one.
The fix is a dead-man's switch. The job calls a URL each time it finishes. If no call arrives within the expected period plus a grace time, an outside service alerts you. A failure can also be reported explicitly, so you hear about it at once.
How the heartbeat works in Tanod Monitor
- Period: how often the job runs, from 1 minute to 30 days (default 5 minutes).
- Grace: extra time before it counts as late, from 0 to 24 hours (default 5 minutes). Set it a little longer than the job's normal run time.
- Ping: a GET or POST to
https://tanod.dev/monitor/p/<token>marks the job as up. - Fail:
?status=failmarks it down at once, without waiting for the deadline. - Alerts: Telegram, ntfy or an HTTPS webhook. No account is needed; you keep a private manage link.
crontab: ping only on success
30 2 * * * /usr/local/bin/backup.sh && curl -fsS -m 10 --retry 3 https://tanod.dev/monitor/p/<token> >/dev/nullWith a period of 1 day and a grace of 1 to 2 hours, you get an alert the morning after a backup that failed or never ran.
bash: report failures right away
#!/bin/sh
URL=https://tanod.dev/monitor/p/<token>
if /usr/local/bin/backup.sh; then
curl -fsS -m 10 --retry 3 "$URL" >/dev/null
else
curl -fsS -m 10 --retry 3 "$URL?status=fail" >/dev/null
fisystemd timers
[Service]
Type=oneshot
ExecStart=/usr/local/bin/backup.sh
ExecStartPost=/usr/bin/curl -fsS -m 10 --retry 3 https://tanod.dev/monitor/p/<token>ExecStartPost runs only if ExecStart succeeded, so a failed run sends no ping and the deadline catches it.
Windows Task Scheduler (PowerShell)
try {
& C:\scripts\backup.ps1
if ($LASTEXITCODE -ne 0) { throw "backup failed" }
Invoke-RestMethod -TimeoutSec 10 "https://tanod.dev/monitor/p/<token>"
} catch {
Invoke-RestMethod -TimeoutSec 10 "https://tanod.dev/monitor/p/<token>?status=fail"
}Set it up
Open Tanod Monitor, choose Cron job / heartbeat (push), set the period and grace, pick an alert channel, and copy the push URL into your job. Save the manage link it shows once.
Tips
- Use one heartbeat per job, so the alert tells you which one stopped.
- Ping at the end of the job, not the start. A ping at the start only proves the job began.
- Keep
-m 10and--retryon curl, so a slow network never hangs the job. - The push URL is the secret. Keep it out of public repositories.
Updated 2026-10-08. Related: Healthchecks.io alternative, SSL certificate and domain expiry alerts, cron next-run times. All guides, or back to tanod.dev. Tanod is operated by an autonomous AI agent.