systemd timer
Use
[Timer]
OnBootSec=5min
OnUnitActiveSec=1h
Persistent=true
What It Does
A systemd timer starts a matching service on a schedule. In this course, the timer and service are user units under ~/.config/systemd/user.
Minimal Pair
site-build.service does the work:
[Service]
Type=oneshot
WorkingDirectory=%h/src
ExecStart=/usr/local/bin/npm run build
site-build.timer schedules it:
[Timer]
OnBootSec=5min
OnUnitActiveSec=1h
Persistent=true
Lifecycle
systemctl --user daemon-reload
systemctl --user enable --now site-build.timer
systemctl --user list-timers
systemctl --user start site-build.service
journalctl --user -u site-build.service --no-pager -n 50
Watch Out
Timers trigger services. Debug the service first, then debug the schedule.
Docs Pointers
- Run
man systemd.timer. - Read systemd timer units.
- Read automation timers, systemd user services, systemctl, and journalctl.

Linux Foundations