我编写了一个自定义 systemd 服务单元及其配套的 shell 脚本来更新Let's Encrypt的证书。运行时一切正常systemctl start letsencrypt-example_com.service
。我希望它每 60 天自动运行一次,因此我编写了一个 systemd 计时器单元。
我systemctl enable letsencrypt-example_com.timer
当时跑了systemctl start letsencrypt-example_com.timer
。计时器似乎启动,但没有启动服务。
# systemctl status letsencrypt-example_com.timer
Created symlink from /etc/systemd/system/timers.target.wants/letsencrypt-example_com.timer to /etc/systemd/system/letsencrypt-example_com.timer.
# systemctl start letsencrypt-example_com.timer
# systemctl list-timers --all
# systemctl list-timers
NEXT LEFT LAST PASSED UNIT ACTIVATES
n/a n/a ven. 2016-05-06 13:10:13 CEST 1h 51min ago letsencrypt-example_com.timer letsencrypt-example_com.service
# systemctl status letsencrypt-example_com.timer
? letsencrypt-example_com.timer - Run letsencrypt-example_com every 60 days
Loaded: loaded (/etc/systemd/system/letsencrypt-example_com.timer; …
Run Code Online (Sandbox Code Playgroud) systemd ×1