SystemD - Timer

> Operating System - Kernel (Windows, Unix, Linux) > Linux / Unix > Linux - Boot (Init service system) > SystemD

1 - About

To start a service at a scheduled time

Doc: systemd.timer

2 - Management

2.1 - Start

The matching .service is:

  • by default the name of the timer (e.g. foo.service for foo.timer)
  • or is specified in the [Timer] section by the Unit= option


  • Realtime timer (Timer units with at least one OnCalendar= directive will have an additional After= dependency on to avoid being started before the system clock has been correctly set.)
Description=Hourly rotation of log files
Documentation=man:logrotate(8) man:logrotate.conf(5)
  • for a Monotonic timer the timer section should be someting like that
  • Copy the unit file and reload the daemon
cp logrotate.timer /lib/systemd/system/
sudo systemctl daemon-reload
  • Enable
sudo systemctl enable logrotate.timer
Created symlink from /etc/systemd/system/ to /usr/lib/systemd/system/logrotate.timer.
  • Start
sudo systemctl start logrotate.timer

2.2 - Status

sudo systemctl status logrotate.timer

2.3 - List

  • Only active
sudo systemctl list-timers
NEXT                         LEFT       LAST                         PASSED       UNIT                         ACTIVATES
Thu 2019-03-07 13:47:23 UTC  29min left Thu 2019-03-07 13:17:23 UTC  21s ago      logrotate.timer              logrotate.service
  • all timers (including inactive)
sudo systemctl list-timers --all

2.4 - Log

sudo journalctl -u logrotate.timer