I have a few clustered servers which I want to upgrade with unattended upgrades - but on different days of the week. Since I can loose multiple nodes in the cluster I want to ensure that one runs unattended-upgrade on Monday, one on Wednesday and one on Friday.
Looking at unattended-upgrades I'm a bit confused when it comes to the scheduling. There are multiple systemd-timers
in relation to apt:
$ systemctl list-timers | head -1; systemctl list-timers | grep -e apt -e update; systemctl list-timers | tail -3NEXT LEFT LAST PASSED UNIT ACTIVATESFri 2023-12-08 12:09:06 CET 2h 10min left Fri 2023-12-08 04:59:42 CET 4h 58min ago apt-daily.timer apt-daily.serviceFri 2023-12-08 14:49:29 CET 4h 51min left Thu 2023-12-07 14:49:29 CET 19h ago update-notifier-download.timer update-notifier-download.serviceSat 2023-12-09 06:08:14 CET 20h left Fri 2023-12-08 06:27:50 CET 3h 30min ago apt-daily-upgrade.timer apt-daily-upgrade.serviceMon 2023-12-11 00:28:08 CET 2 days left Fri 2023-12-08 04:10:29 CET 5h 47min ago update-notifier-motd.timer update-notifier-motd.service12 timers listed.Pass --all to see loaded but inactive timers, too.
But none of them seem to trigger unattended-upgrades
.
There is a system.service
- but it does not seem to have very rich scheduling capabilities:
$ systemctl status unattended-upgrades● unattended-upgrades.service - Unattended Upgrades Shutdown Loaded: loaded (/lib/systemd/system/unattended-upgrades.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2023-11-17 14:40:05 CET; 2 weeks 6 days ago Docs: man:unattended-upgrade(8) Main PID: 866 (unattended-upgr) Tasks: 2 (limit: 9389) Memory: 10.8M CPU: 83ms CGroup: /system.slice/unattended-upgrades.service└─866 /usr/bin/python3 /usr/share/unattended-upgrades/unattended-upgrade-shutdown --wait-for-signalNov 17 14:40:05 hostname systemd[1]: Started Unattended Upgrades Shutdown.
I guess I could write my owntimer
and have it trigger another invocation of unattended-upgrades
- but that feels a bit like over engineering something someone has probably already solved better.
How do I spread the unattended-upgrade
schedule over the week?