Link to this headingTimers
wiki.archlinux.org/title/Systemd/Timers
https://systemd-by-example.com/
Link to this headingMaking a Timer with a Service
Run 15mins after boot and then every week
Monotonic timer from a Service:
# This service unit is for testing timer units
# By David Both
# Licensed under GPL V2
#
Description=Logs
Wants=myMonitor.timer
Type=oneshot
ExecStart=/usr/bin/free
WantedBy=multi-user.target
Description=Logs
Requires=myMonitor.service
Unit=myMonitor.service
OnCalendar=*-*-*
WantedBy=timers.target
Still run the command immediately after boot if the computer was turned off during that time.
Realtime timer:
Description=Weekly
OnCalendar=weekly
RandomizedDelaySec=3h
Persistent=true
WantedBy=timers.target
Link to this headingRunning a Timer
Run a Timer:
Testing that the Timer ran:
Link to this headingMake Timer without service
Run in 30 seconds:
Run in 30 seconds after boot:
Run every week:
Link to this headingCheck Timers
Link to this headingMake a User Timer
- Make a service for a user at
~/.config/systemd/user/SERVICE_NAME.service - Make a timer for the service at
~/.config/systemd/user/SERVICE_NAME.timer - Reload systemd
systemctl --user daemon-reload - Start timer
systemctl --user enable --now SERVICE_NAME.timer - Check timer is enabled
systemctl --user list-timers
Example Timer:
Description=Run
OnCalendar=10:30
Persistent=true
WantedBy=timers.target