我正在尝试为 certbot 设置自动续订,并在中创建了以下两个文件/etc/systemd/system/
:
- certbot.service
[Unit] Description=Let's Encrypt renewal [Service] Type=oneshot ExecStart=/usr/local/bin/certbot renew --agree-tos ExecStartPost=/bin/systemctl reload nginx.service
- certbot.timer
[Unit] Description=Twice daily renewal of Let's Encrypt's certificates [Timer] OnCalendar=0/12:00:00 RandomizedDelaySec=1h Persistent=true [Install] WantedBy=timers.target
我使用 启用了计时器sudo systemctl enable certbot.timer
,它打印了:
Created symlink /etc/systemd/system/timers.target.wants/certbot.timer → /etc/systemd/system/certbot.timer.
我在两台机器上完成了这个操作:一台在 Ubuntu 20.04.6 上,一台在 Debian GNU/Linux 10 上。Ubuntu 的显示如下:
● certbot.timer - Twice daily renewal of Let's Encrypt's certificates
Loaded: loaded (/etc/systemd/system/certbot.timer; enabled; vendor preset: enabled)
Active: active (waiting) since Wed 2023-06-21 10:46:01 CEST; 23min ago
Trigger: Wed 2023-06-21 12:03:21 CEST; 53min left
Triggers: ● certbot.service
而 Debian 似乎没有触发器部分:
● certbot.timer - Twice daily renewal of Let's Encrypt's certificates
Loaded: loaded (/etc/systemd/system/certbot.timer; enabled; vendor preset: enabled)
Active: active (waiting) since Wed 2023-06-21 10:58:21 CEST; 11min ago
Trigger: Wed 2023-06-21 12:46:51 CEST; 1h 36min left
但是该文件存在:
$ ls /etc/systemd/system/certbot.*
/etc/systemd/system/certbot.service /etc/systemd/system/certbot.timer
我是否只需要等待,或者是否需要执行其他操作?