0

我希望 apt-update 计时器在周日晚上 4:30 到 5:30 之间运行,然后是 apt-upgrade 计时器。我有这些设置:

cat << 'EOF' > /etc/systemd/system/apt-daily.timer
[Unit]
Description=Daily apt download activities

[Timer]
OnCalendar=Sun *-*-* 4:30:00
RandomizedDelaySec=60m
Persistent=true

[Install]
WantedBy=timers.target
EOF

cat << 'EOF' > /etc/systemd/system/apt-daily-upgrade.timer
[Unit]
Description=Daily apt upgrade and clean activities
After=apt-daily.timer

[Timer]
OnCalendar=Sun *-*-* 4:30:00
RandomizedDelaySec=60m
Persistent=true

[Install]
WantedBy=timers.target
EOF

systemctl daemon-reload

但有时会发生这种情况:

# systemctl list-timers
NEXT                         LEFT         LAST                         PASSED       UNIT                         ACTIVATES  
Sun 2022-01-16 04:43:35 CET  6 days left  Sun 2022-01-09 21:52:31 CET  7min ago     apt-daily-upgrade.timer      apt-daily-upgrade.service
Sun 2022-01-16 04:53:48 CET  6 days left  Sun 2022-01-09 21:52:31 CET  7min ago     apt-daily.timer              apt-daily.service

Systemd 忽略该选项After=apt-daily.timer。我怎样才能解决这个问题?

4

0 回答 0