我今天注意到几天前禁用的 systemd 计时器仍在运行。再次禁用它似乎没有任何效果。我可能忽略了一些基本知识(我对 systemd 还很陌生),但我真正做的就是遵循网上看似一般的建议。
root@nla-cloud:/var/log# systemctl list-timers
NEXT LEFT LAST PASSED UNIT ACTIVATES
Fri 2017-10-13 00:00:00 UTC 13h left Thu 2017-10-12 00:00:01 UTC 10h ago delete_dummies.timer delete_dummies.service
这里没有反馈说符号链接已被删除(这是我第一次禁用它时发生的情况 - 日志丢失):
root@nla-cloud:/var/log# systemctl disable delete_dummies.timer
是的,仍活跃并等待......
root@nla-cloud:/var/log# systemctl status delete_dummies.timer
delete_dummies.timer - Deletes dummy devices at midnight
Loaded: loaded (/lib/systemd/system/delete_dummies.timer; disabled; vendor preset: enabled)
Active: active (waiting) since Thu 2017-10-05 09:22:44 UTC; 1 weeks 0 days ago
Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.
计时器:
[Unit]
Description=Deletes dummy devices at midnight
[Timer]
OnCalendar=daily
Persistent=true
[Install]
WantedBy=multi-user.target
单元:
[Unit]
Description=Delete dummy device entries.
[Service]
Type=simple
ExecStart=/usr/bin/delete_dummies.sh
我喜欢 systemd。