Skip to main content

Guide

Monitor a systemd timer

A systemd timer with Persistent=false does not replay a calendar run missed while the host was down. Report successful work to PostDeploy so the missing run becomes visible.

Start your 14-day free trial No card required. The trial uses Pro limits.
By Paul , published , last verified

The missed run systemd does not replay

For a timer with OnCalendar=, Persistent= controls whether systemd catches up after the machine was inactive. It defaults to false. If the host is off at the scheduled time, the timer starts normally later but the missed work does not run.

Set Persistent=true when catch-up work is correct for the task. Keep a heartbeat even then. It verifies that the service completed rather than only that the timer became active.

Create the timer and service

Put the work and heartbeat in a oneshot service. The shell uses && so a success ping follows successful work only. Enable the timer, not the service.

Example shell
# /etc/systemd/system/nightly-report.service
[Service]
Type=oneshot
ExecStart=/bin/sh -c '/opt/report/bin/run && curl -fsS https://ingest.postdeploy.dev/h/hb_YOUR_TOKEN'

# /etc/systemd/system/nightly-report.timer
[Timer]
OnCalendar=*-*-* 03:17:00
Persistent=true

[Install]
WantedBy=timers.target

Enable and verify it

Reload systemd after writing both unit files. Start the timer, then start the service once by hand. Confirm the heartbeat arrives before you rely on the next calendar time.

Example shell
sudo systemctl daemon-reload
sudo systemctl enable --now nightly-report.timer
sudo systemctl start nightly-report.service
systemctl list-timers nightly-report.timer

Find a missed run

If the heartbeat is late, check the timer's next and last trigger time, then inspect the service journal. A timer that never triggered after a host outage likely had Persistent=false when it missed the calendar time.

Example shell
systemctl status nightly-report.timer && journalctl -u nightly-report.service --since yesterday

Questions

Does systemd replay a missed timer by default?

No. Persistent= defaults to false. For calendar timers, a missed run while the system was inactive is not replayed when the timer activates.

Should I set Persistent=true?

Set it when one catch-up run is safe and useful. Do not use it for work where late execution can damage data or create an unwanted backlog.

What PostDeploy does not do here

  • PostDeploy does not inspect systemd unit state or the journal
  • PostDeploy does not start a stopped service unit
  • PostDeploy does not change Persistent= on a timer

Sources

Links are the platform's own documentation for the failure mode described above.

Monitor this timer with PostDeploy

14 days at Pro limits. No card required.

Start your 14-day free trial