【问题标题】:change letsencrypt certbot run time更改letsencrypt certbot运行时间
【发布时间】:2018-09-13 17:02:36
【问题描述】:

我已经设置了 certbot 来更新 letencrypt 密钥。这行得通。

当我在 /etc/log/letsencrypt 检查我的日志时,我发现它每天运行两次。 午夜左右的某个地方,中午左右的某个地方。

我想每天早上只在某个地方运行一次。

为了控制 certbot 的运行,我从我的 cronjobs 中删除了所有条目。但没想到它仍然运行。

那么 certbot 是如何启动的呢?

额外信息:

当我运行一个脚本来显示所有 cronjobs 时,我得到了这个: (脚本:How do I list all cron jobs for all users?

mi  h    d  m  w  user  command
0   3    *  *  1  root  /usr/bin/rsnapshot weekly
0   */4  *  *  *  root  /usr/bin/rsnapshot hourly
16  10   *  *  *  root  test -x /etc/cron.daily/popularity-contest && /etc/cron.daily/popularity-contest --crond
25  6    *  *  *  root  /etc/cron.daily/apache2
25  6    *  *  *  root  /etc/cron.daily/apt-compat
25  6    *  *  *  root  /etc/cron.daily/aptitude
25  6    *  *  *  root  /etc/cron.daily/automysqlbackup
25  6    *  *  *  root  /etc/cron.daily/bsdmainutils
25  6    *  *  *  root  /etc/cron.daily/dpkg
25  6    *  *  *  root  /etc/cron.daily/exim4-base
25  6    *  *  *  root  /etc/cron.daily/logrotate
25  6    *  *  *  root  /etc/cron.daily/man-db
25  6    *  *  *  root  /etc/cron.daily/mlocate
25  6    *  *  *  root  /etc/cron.daily/ntp
25  6    *  *  *  root  /etc/cron.daily/passwd
25  6    *  *  *  root  /etc/cron.daily/popularity-contest
25  6    *  *  *  root  /etc/cron.daily/tomcat8
30  2    1  *  *  root  /usr/bin/rsnapshot monthly
30  3    *  *  *  root  /usr/bin/rsnapshot daily
47  6    *  *  7  root  /etc/cron.weekly/man-db

我从 certbot 中找到的文件是 /etc/cron.d 中的 certbot

它包含这一行:

#0 4 * * * root test -x /usr/bin/certbot -a \! -d /run/systemd/system && perl -e 'sleep int(rand(3600))' && certbot -q renew

我注释掉了(用#号)。

我的系统是debian:

Debian GNU/Linux 9

【问题讨论】:

    标签: cron lets-encrypt certbot


    【解决方案1】:

    我在 Ubuntu 16.04 + nginx 上使用 certbot 有两个地方可以检查与 Certbot 相关的作业

    1) /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 && nginx -s reload

    2) 系统定时器

    运行命令: $sudo systemctl list-timers

    查看输出

    Sun 2018-07-08 00:46:59 EEST 7h left Sat 2018-07-07 12:36:26 EEST 4h 51min 前 certbot.timer certbot.service

    然后

    3)

    查看systemctl运行Certbot时控制时间的文件

    /etc/systemd/system/timers.target.wants/certbot.timer

    这是

    的符号链接

    /lib/systemd/system/certbot.timer

    注意定义时间 + 随机秒数的这行(设置随机时间,以免同时对服务器造成压力)

    OnCalendar=--* 00,12:00:00

    RandomizedDelaySec=3600

    【讨论】:

      猜你喜欢
      • 2018-08-05
      • 2017-07-07
      • 2017-09-05
      • 2017-02-23
      • 2016-11-30
      • 2019-05-29
      • 2019-09-04
      • 2016-10-25
      • 2021-08-17
      相关资源
      最近更新 更多