1. What you'll need
- A job that runs on a schedule - a cron entry, a systemd timer, a CI step or a scheduled worker.
- A free Uptimewolf account (the free tier includes two heartbeats).
- The ability to add one line to the job, or wrap it in a small script.
2. Monitor a cron job in three steps
- Create a heartbeat monitor. In Uptimewolf, add a heartbeat, set the schedule the job runs on and a grace window for normal variation. You'll get a unique ping URL.
- Add the ping to your job. Append a one-line curl call to the end of the cron entry so it pings the URL only after the job succeeds.
- Test and connect alerts. Run the job once to confirm the ping arrives, then attach an alert channel so a missed run reaches you.
# run the backup at 02:30, then ping only if it succeeded
30 2 * * * /usr/local/bin/backup.sh && curl -fsS https://uptimewolf.com/ping/your-heartbeat-id > /dev/null
3. The same idea in other environments
The pattern is always "do the work, then ping on success". A few variations:
- Inside a script: put the curl call on the last line, after a successful exit, rather than in the crontab.
- Docker / systemd timers: add the ping to the container command or the service's ExecStart wrapper.
- From code: make an HTTP GET to the ping URL at the end of a serverless function or worker run.
4. Common questions
How do I know if my cron job failed?
Without monitoring, you usually don't until you need its output. With a heartbeat, a cron job pings Uptimewolf on success; if the ping doesn't arrive in the grace window, you're alerted that the run was missed.
Where do I put the curl command?
At the end of the cron entry, after the real command, joined with && so the ping only fires on success: your-job && curl -fsS
What grace window should I set?
A little longer than the job's normal run time plus its normal lateness. If a backup usually finishes within 10 minutes of its scheduled time, a 15 to 20 minute grace window avoids false alarms while still catching a genuine stall.
Does this work for things other than cron?
Yes. Anything that can send an HTTP request can ping a heartbeat: systemd timers, Docker cron, CI jobs, serverless functions and queue workers.