How to monitor a cron job and get alerted when it fails
A cron job that silently stops is one of the most common — and most dangerous — kinds of production failure. Cron won't email you when a job doesn't run, and if the machine is asleep, overloaded, or the job hangs, nothing happens at all. The fix is a dead-man's-switch: instead of watching for errors, you watch for the absence of a success signal.
The pattern
Have the job tell a monitor "I ran successfully" every time it finishes. If that signal doesn't arrive on schedule, the monitor alerts you. Add one line to the end of your cron entry:
The && matters: the ping only fires if backup.sh exits 0. If the script fails — or never runs — the ping is skipped, the window lapses, and you get an email.
Signal failures explicitly, too
You don't have to wait for the window to lapse. Ping a /fail endpoint on error to go DOWN immediately:
Why not just check logs or exit codes?
Log checks and exit-code handling only run when the job runs. They can't catch the case that hurts most: the job that didn't run at all — a broken crontab, a dead box, a paused container. A heartbeat monitor catches all of those because it triggers on silence.
Cronping does exactly this, free: 20 checks, 1-minute resolution, email + Slack/Discord alerts, no credit card. Create a check and get a ping URL in about ten seconds.
Get a ping URL in about ten seconds — no account, no email needed. Add an email later for alerts.