TIL - Systemd timers additive OnCalender property

Overriding a systemd timer is done by creating an override.conf file on the timer directory. On this case will be looking into the apt daily timer, which I run together with auto-upgrades:

touch /etc/systemd/system/apt-daily.timer.d/override.conf

To configure the time at which the timer runs, use:

[Timer]
OnCalendar=
OnCalendar=*-*-* 22:00

Note that the OnCalendar property is duplicated, the first definition been empty. This empty definition is to reset the existing timer, otherwise the override OnCalender will be added on top of the eixisting one, creating a second time at which the timer will run rather than overriding the existing timer time.

After adding the new file the timer needs to be restarted and systemctl needs to be restarted:

systemctl restart apt-daily.timer
systemctl daemon-reload

To check that the timer was correctly updated:

systemctl status apt-daily.timer
systemctl list-timers apt-daily.timer
cat /etc/systemd/system/apt-daily.timer.d/override.conf
systemctl cat apt-daily.timer

Other commands:

# See when systemctl was restarted
systemctl show systemd-journald --property=ActiveEnterTimestamp
# Check if timer needs reload
systemctl show apt-daily.timer --property=NeedDaemonReload
# Check journalctl logs for the services triggered by the timers
journalctl -u apt-daily.service --since "24 hours ago"