Monitor systemd timers with a ping
On this page
A systemd timer fails quietly in three ways: the service exits non-zero and nobody reads the journal, the machine was off at the scheduled time, or the timer unit is no longer enabled. ExecStartPre and ExecStopPost let the service report on itself.
How can a scheduled job fail silently on systemd timers?
- A timer fires with an accuracy window that defaults to one minute (AccuracySec), so a run can start up to a minute after its calendar time.
- Without Persistent=true, a timer does not catch up after the machine was off at the scheduled time. With it, systemd stores the last trigger time on disk and runs the service when the timer is activated if a run was missed.
- The timer starts the service named like itself (the Unit= default). A typo or a renamed service leaves a timer that fires and does nothing useful.
- A service that fails leaves a failed unit and a journal entry, not a notification; systemd sends no mail by itself.
What are the limits of systemd timers?
| Limit | What the documentation says |
|---|---|
| AccuracySec | Defaults to 1 minute: the timer elapses within a window that starts at the calendar time. |
| RandomizedDelaySec | Defaults to 0. A higher value spreads timers out and makes every run later by up to that long. |
| Persistent | Takes effect only for timers with OnCalendar=. When true, the last trigger time is kept on disk and a missed run is triggered when the timer is activated. |
| Unit | The unit to activate; defaults to the service with the same name as the timer. |
| OnClockChange, OnTimezoneChange | Boolean options that trigger the service when the clock jumps or the time zone changes. |
How do you add a CronMissed ping to systemd timers?
The service reports the start before the job and the result after it. The leading - on both commands means a failed ping never fails the unit. The timer uses Persistent=true so a run missed while the machine was off still happens.
[Unit]
Description=nightly-backup
[Service]
Type=oneshot
ExecStartPre=-/usr/bin/curl -fsS --max-time 10 --retry 5 --retry-connrefused -o /dev/null "https://ping.cronmissed.com/5f0c1b2e-7a3d-4c8e-9b61-2d4f8a7e3c10/start"
ExecStart=/usr/local/bin/backup.sh
ExecStopPost=-/bin/sh -c 'case "$$EXIT_STATUS" in [0-9]*) s=$$EXIT_STATUS ;; *) s=fail ;; esac; curl -fsS --max-time 10 --retry 5 --retry-connrefused -o /dev/null "https://ping.cronmissed.com/5f0c1b2e-7a3d-4c8e-9b61-2d4f8a7e3c10/$$s"'[Unit]
Description=Run nightly-backup on schedule
[Timer]
OnCalendar=*-*-* 02:30:00 UTC
Persistent=true
[Install]
WantedBy=timers.targetWhich check settings fit systemd timers?
A cron check with the same schedule works for OnCalendar timers that CronMissed can express as five fields. Otherwise use a simple check whose period matches the timer. Set the grace to the usual run time plus AccuracySec (one minute by default) plus any RandomizedDelaySec. A start ping gives you the duration of every run for free.
How do you confirm the check works?
- Run systemctl start nightly-backup.service by hand and confirm the start and success pings arrive.
- Run systemctl list-timers and make sure the next run is listed and the unit is active.
- Change the command to /bin/false, start the service, and confirm the check goes down with the exit status.
Sources
- systemd.timer manual page , read 22 October 2026
Questions and answers
- It tells systemd to ignore a failure of that command. A ping that cannot reach CronMissed then never stops the real job from running.
- In ExecStopPost the variable EXIT_STATUS holds the exit code, or the signal name when the process was killed. The snippet sends /fail in that case, which marks the check down at once.
What does the dash in ExecStartPre=- do?
How do I get the exit status of a service that was killed?
Create a check, add the ping to the job, and CronMissed alerts you the first time a run is late or reports a failure.
Start monitoring