0我猜他们想把请求分散在整个12小时内,而不仅仅是第一个小时。我需要帮助,因为我对cron还比较陌生。。。我运行Ubuntu18.04并成功获得证书后。运行crontab-l或sudo crontab-l显示没有用于“”的crontab。这应该发生吗?我如

0我猜他们想把请求分散在整个12小时内,而不仅仅是第一个小时。我需要帮助,因为我对cron还比较陌生。。。我运行Ubuntu18.04并成功获得证书后。运行crontab-l或sudo crontab-l显示没有用于“”的crontab。这应该发生吗?我如,cron,lets-encrypt,Cron,Lets Encrypt,0我猜他们想把请求分散在整个12小时内,而不仅仅是第一个小时。我需要帮助,因为我对cron还比较陌生。。。我运行Ubuntu18.04并成功获得证书后。运行crontab-l或sudo crontab-l显示没有用于“”的crontab。这应该发生吗?我如何知道上面引用的cronjob是否将运行?如何检查?我希望您编辑答案并添加@HamishDowner注释。这澄清了一个非常重要的问题。如果你是一个Raspberry PI用户,这是一个好方法,不要弄乱crontab。这篇文章应该得到更多的信任。


0我猜他们想把请求分散在整个12小时内,而不仅仅是第一个小时。我需要帮助,因为我对cron还比较陌生。。。我运行Ubuntu18.04并成功获得证书后。运行
crontab-l
sudo crontab-l
显示没有用于“”的crontab。这应该发生吗?我如何知道上面引用的cronjob是否将运行?如何检查?我希望您编辑答案并添加@HamishDowner注释。这澄清了一个非常重要的问题。如果你是一个Raspberry PI用户,这是一个好方法,不要弄乱crontab。这篇文章应该得到更多的信任。对于大量使用Debian、Ubuntu等的用户来说,不需要设置自己的cron和“它只是更新”,这是一件大事。
sudo letsencrypt renew --dry-run --agree-tos
sudo crontab -e
12 3 * * *   letsencrypt renew >> /var/log/letsencrypt/renew.log
0 0,12 * * * python -c 'import random; import time; time.sleep(random.random() * 3600)' && /usr/local/bin/certbot-auto renew
sudo bash -c "letsencrypt renew >> /var/log/letsencrypt/renew.log"
# /etc/cron.d/certbot: crontab entries for the certbot package
#
# Upstream recommends attempting renewal twice a day
#
# Eventually, this will be an opportunity to validate certificates
# haven't been revoked, etc.  Renewal will only occur if expiration
# is within 30 days.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

0 */12 * * * root test -x /usr/bin/certbot -a \! -d /run/systemd/system && perl -e 'sleep int(rand(3600))' && certbot -q renew
1  1    * * *   root    sleep ${RANDOM:0:3}m && /home/admin/certbot-auto renew --quiet --no-self-upgrade --authenticator webroot --installer apache -w /var/www/mywebroot
#cat /etc/cron.d/certbot

0 */12 * * * root test -x /usr/bin/certbot -a \! -d /run/systemd/system && perl -e 'sleep int(rand(3600))' && certbot -q renew
[Service]
Type=oneshot
ExecStart=/usr/bin/certbot -q renew
PrivateTmp=true
dpkg-query -L certbot
...
/lib/systemd/system/certbot.service
/lib/systemd/system/certbot.timer
...
# /etc/systemd/system/certbot-renewal.service
[Unit]
Description=Certbot Renewal
[Service]
ExecStart=/usr/local/bin/certbot -q renew --post-hook "systemctl reload nginx"
# /etc/systemd/system/certbot-renewal.timer
[Unit]
Description=Run certbot twice daily

[Timer]
OnCalendar=*-*-* 00,12:00:00
RandomizedDelaySec=43200
Persistent=true

[Install]
WantedBy=timers.target
sudo systemctl start certbot-renewal.timer
sudo systemctl enable certbot-renewal.timer
sudo systemctl list-timers --all
sudo journalctl -u certbot-renewal.service