![Systemd 计时器不会触发](https://linux22.com/image/186500/Systemd%20%E8%AE%A1%E6%97%B6%E5%99%A8%E4%B8%8D%E4%BC%9A%E8%A7%A6%E5%8F%91.png)
我在 Debian Buster 上遇到了一个非常奇怪的问题。我已经在服务器上启用了无人值守升级,因为这是一个非常简单的服务器,它应该自动更新。然而,似乎这方面的适当计时器从未启动。
当我检查所有计时器时,我得到以下信息:
# systemctl list-timers
NEXT LEFT LAST PASSED UNIT ACTIVATES
Fri 2021-01-15 20:00:00 UTC 58min left Fri 2021-01-15 19:00:00 UTC 1min 13s ago logrotate.timer logrotate.service
Sat 2021-01-16 00:00:00 UTC 4h 58min left Fri 2021-01-15 00:00:00 UTC 19h ago man-db.timer man-db.service
Sat 2021-01-16 18:03:26 UTC 23h left Fri 2021-01-15 18:03:26 UTC 57min ago systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service
n/a n/a Thu 2020-11-26 06:15:45 UTC 1 months 20 days ago apt-daily-upgrade.timer apt-daily-upgrade.service
n/a n/a Wed 2020-11-25 20:32:27 UTC 1 months 20 days ago apt-daily.timer apt-daily.service
当我检查计时器的定义时,看起来不错:
# systemctl cat apt-daily.timer
# /lib/systemd/system/apt-daily.timer
[Unit]
Description=Daily apt download activities
[Timer]
OnCalendar=*-*-* 6,18:00
RandomizedDelaySec=12h
Persistent=true
[Install]
WantedBy=timers.target
分析似乎同意语法很好:
# systemd-analyze calendar "*-*-* 6,18:00"
Original form: *-*-* 6,18:00
Normalized form: *-*-* 06,18:00:00
Next elapse: Sat 2021-01-16 06:00:00 UTC
From now: 10h left
但他们不开火。我尝试运行systemctl start apt-daily.timer
,systemctl enable --now apt-daily.timer
但systemctl restart timers.target
没有效果。该命令返回时没有错误,但没有任何变化。
我不知道如何进一步调试这个问题,任何提示将不胜感激。
答案1
发现我的问题,我需要升级 systemd。当然,这就是这些工作应该做的事情......