我尝试使用 systemd 计时器配置无人值守升级,如下所述这里
我配置的/etc/systemd/system/apt-daily-upgrade.timer.d/override.conf
文件如下:
[Unit]
Description=Daily apt upgrade and clean activities
After=apt-daily.timer
[Timer]
OnCalendar=Mon,Wed,Fri 6:00
RandomizedDelaySec=60m
Persistent=true
[Install]
WantedBy=timers.target
当我检查下一次触发时间时,我得到了:
# systemctl status apt-daily-upgrade.timer
● apt-daily-upgrade.timer - Daily apt upgrade and clean activities
Loaded: loaded (/lib/systemd/system/apt-daily-upgrade.timer; enabled; vendor preset: enabled)
Drop-In: /etc/systemd/system/apt-daily-upgrade.timer.d
└─override.conf
Active: active (waiting) since Wed 2020-03-11 13:23:17 UTC; 53min ago
Trigger: Thu 2020-03-12 06:31:32 UTC; 16h left
因此它应该在下周四触发,但在 OnCalendar 参数中未定义。
没有看到我错过什么 :/
谢谢
答案1
发现,计时器是累积的,因此应该重置现有的计时器:
[Timer]
OnCalendar=
OnCalendar=Mon,Wed,Fri 6:00
现在它运行良好。