Cron job monitoring: a practical guide for crontab, Kubernetes and GitHub Actions
Cron has one design flaw that has outlived every server it ever ran on: when a job doesn't run, nothing happens. No error, no log line, no email. The backup that stopped in March looks exactly like the backup that ran last night, until the day you need to restore it.
This guide covers how to monitor cron jobs so that "didn't run" becomes an alert, on the three places scheduled jobs usually live.
Why logs and error tracking aren't enough
Logs and exception trackers report things that happened. The dangerous cron failures are things that didn't:
- the server was replaced and nobody copied the crontab;
- the job's environment changed (
PATH, credentials) and it dies before logging anything; - the CronJob was suspended during an incident and never resumed;
- the job hangs on a lock and never finishes.
To catch an absence, something outside the job has to expect it.
How heartbeat monitoring works
- You create a monitor with the job's schedule (an interval or a cron expression) and a grace period.
- The job calls a unique URL when it finishes successfully. That's the check-in.
- If no check-in arrives by schedule + grace, the monitor alerts you.
- When the job checks in again, the monitor recovers.
Two rules make it reliable:
- Ping at the end, not the start. A ping at the start only proves the job launched.
- Ping only on success. Chain it with
&&so a failing job stays silent and the monitor notices.
crontab
# nightly database backup at 02:00 UTC
0 2 * * * /usr/local/bin/backup.sh && curl -fsS --retry 3 -X POST https://cronobserver.com/checkin/<token> > /dev/null
-fmakes curl fail on HTTP errors,-sSstays quiet but shows errors.--retry 3survives a network blip, so you don't get a false alarm.- Schedules in CronObserver are in UTC, so write the monitor's cron in UTC too.
Kubernetes CronJob
Append the check-in to the container command:
apiVersion: batch/v1
kind: CronJob
metadata:
name: report
spec:
schedule: "0 6 * * *"
jobTemplate:
spec:
template:
spec:
restartPolicy: OnFailure
containers:
- name: report
image: your-image:latest
env:
- name: CRONOBSERVER_CHECKIN_URL
valueFrom:
secretKeyRef: { name: cronobserver, key: checkin-url }
command: ["sh", "-c", "run-report && curl -fsS -X POST $CRONOBSERVER_CHECKIN_URL"]
This catches the Kubernetes-specific silent failures: a suspended CronJob,
a missed schedule past startingDeadlineSeconds, a run skipped by
concurrencyPolicy: Forbid, or a pod stuck in ImagePullBackOff. None of
these throw an error your app can see.
GitHub Actions scheduled workflows
on:
schedule:
- cron: "0 3 * * *"
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: ./sync.sh
- name: Check in
if: success()
run: curl -fsS -X POST "${{ secrets.CRONOBSERVER_CHECKIN_URL }}"
Scheduled workflows are a classic silent failure: GitHub can delay or drop runs under load and disables schedules in repositories with no activity for 60 days. The heartbeat is the only thing that notices.
Choosing the grace period
| Job type | Typical grace |
|---|---|
| Every 5 minutes | 2–5 minutes |
| Hourly | 10–15 minutes |
| Daily, fast (< 5 min) | 30 minutes |
| Daily, slow or variable (exports, AI agents) | slowest normal run + 50% |
Start generous, look at a week of real check-ins, then tighten.
Send context with the check-in
The check-in accepts an optional JSON body. It is stored with each run:
curl -fsS -X POST https://cronobserver.com/checkin/<token> \
-H "Content-Type: application/json" \
-d '{"status":"success","processed":1520,"durationMs":48200,"host":"worker-01"}'
When a job starts behaving strangely, the last good payloads tell you what "normal" looked like.
Who gets the alert
Alerts that go to a shared inbox nobody reads are the same as no alerts. Route each monitor to the people who own the job: email on any plan, and Slack, Microsoft Teams, Telegram and webhooks on the paid plans, and escalation steps on Team and up. Use mute and maintenance windows for planned downtime, so the alerts you do get are real.
Summary
- Monitor the absence: one heartbeat per job, at the end, only on success.
- Use the same schedule as the job, in UTC, plus a realistic grace period.
- Add
--retryto the ping so the network doesn't page you. - Send a small JSON payload for context.
- Route alerts to the job's owner.
Set up your first cron monitor in 2 minutes. New accounts get 14 days of the Team plan, no credit card. Then a paid plan from US$ 9/month, or stay on Free with 5 monitors. Start monitoring →