Guide · Cron jobs
Monitor cron jobs with a dead man's switch
Cron is excellent at running a job on schedule and saying absolutely nothing else, ever. If it silently stops running your job, cron itself will never tell you. A dead man's switch will.
1. What cron doesn't tell you
Cron (or Windows Task Scheduler, or a Kubernetes CronJob) only cares about firing your command at the right time. It has no idea whether the job actually did its job. If the cron daemon is down, a host reboots into a bad state, a deploy silently drops the crontab entry, or the script dies before reaching the line that matters, nothing complains. There is no error, no email, no red X anywhere. You find out when someone notices the backup, the report, or the sync hasn't run in days.
2. The check-in model
A dead man's switch flips the responsibility around. Instead of relying on the job to report when something went wrong, Mortemain waits for it to report when things went right, and alerts you the moment that confirmation stops arriving. You create a check, get a unique ping URL back, and add one request to the job so it calls that URL when it finishes:
# the last thing your job does curl -fsS -m 10 https://ping.mortemain.com/your-check-uuid
If that request doesn't land within the check's schedule and grace window, Mortemain marks it down and alerts you. There's no agent to install and no SDK to import, it's one HTTP request that a cron job, a PowerShell task, a Python script, or a container can all already make.
3. Add it to the job you actually run
The check-in itself is always the same idea, but the exact line depends on what's running the job. Pick your platform for copy-pasteable code:
Shell script & cron (curl)
Linux and macOS: append one curl to any script or crontab line.
Windows & PowerShell
Scheduled Tasks and scripts with Invoke-RestMethod.
Python
A few lines with requests, plus a wrap-the-whole-script pattern.
Kubernetes CronJob
Add a check-in to a CronJob without touching your image.
4. Catch failures immediately, and slow runs too (optional)
A plain check-in only tells Mortemain the job hasn't finished yet, it can't say why. Two extra signals close that gap, and both are covered with exact code in each platform guide above:
/fail, requested from your error handler, forces the check down immediately instead of waiting for the window to lapse./start, requested when the job begins, lets Mortemain measure how long each run takes, so a job that suddenly runs four times longer shows up as a warning before it becomes an outage.
Test it
Trigger the job once by hand and watch its check flip to up within a second or two. Then disable the job, comment out the crontab line, pause the CronJob, and wait past its window. The down alert that follows is the whole point: it's the message cron was never going to send you.