brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: Persistent=true makes a systemd timer catch up after downtime

Systemd
~/tips/tip-systemd-timer-persistent-true

Persistent=true

Runs a missed timer job once after the machine comes back instead of skipping it.

A nightly job on a machine that is switched off at night would simply never run, unless the timer remembers.

[Timer]
OnCalendar=daily
Persistent=true

With Persistent=true systemd stores the last trigger time on disk, in /var/lib/systemd/timers. If the machine was off at the scheduled time, the unit starts right after the next boot. It only applies to timers with OnCalendar=. A timer that triggers many times while the machine was off still runs the service just once. Check the state with systemctl list-timers --all.

Further reading: systemd.timer manual page

More Systemd tips [Service] sudo mkdir -p /etc/systemd/system/service.d [Service] printf 'hunter2' | sudo systemd-creds encrypt --name=dbpass – dbpass.cred systemd-analyze timespan 1h30min All Systemd tips (88) All topics

Link