letsencrypt / certbot Systemd Timer / Dienst funktioniert nicht unter Ubuntu 18.04

598
moritzjacobs

Ich habe certbot für nginx installiert und das Skript automatisch neu eingerichtet. Dies ist jedoch die E-Mail, die ich bekomme, wenn sie ausgeführt wird:

/home/foobar/certbot-renew.sh: 1: /home/foobar/certbot-renew.sh: /usr/bin/certbot: not found

Was mich verwirrt ist, es gibt kein certbot-renew.shin meinem Heimatverzeichnis ...?

Weitere Informationen von systemctl:

# /lib/systemd/system/certbot.timer [Unit] Description=Run certbot twice daily  [Timer] OnCalendar=*-*-* 00,12:00:00 RandomizedDelaySec=43200 Persistent=true  [Install] WantedBy=timers.target 

und

# /lib/systemd/system/certbot.service [Unit] Description=Certbot Documentation=file:///usr/share/doc/python-certbot-doc/html/index.html Documentation=https://letsencrypt.readthedocs.io/en/latest/ [Service] Type=oneshot ExecStart=/usr/bin/certbot -q renew PrivateTmp=true 

Ich bin neu im Umgang mit systemd, Hilfe wird geschätzt!

Bearbeiten:

Wie @ grawity vorschlug, habe ich stattdessen meine Crontabs überprüft und Folgendes gefunden:

foo@bar:~$ cat /etc/crontab # /etc/crontab: system-wide crontab # Unlike any other crontab you don't have to run the `crontab' # command to install the new version when you edit this file # and files in /etc/cron.d. These files also have username fields, # that none of the other crontabs do.  SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin  # m h dom mon dow user command 17 * * * * root cd / && run-parts --report /etc/cron.hourly 25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) 47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly ) 52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly ) # 

Auch das:

foo@bar:~$ cat /etc/cron.d/certbot # /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(43200))' && certbot -q renew 

Zu klären:

foo@bar:~$ which certbot /usr/bin/certbot  foo@bar:~$ certbot --version certbot 0.26.1 
1

1 Antwort auf die Frage

0
grawity

Systemd-Dienste generieren keine E-Mail-Benachrichtigungen. Cron Jobs tun.

All dies weist darauf hin, dass Ihre angezeigten systemd-Einheiten nicht mit dem Problem zusammenhängen (möglicherweise funktionieren sie bereits ohne Probleme) - die gleiche Aufgabe wird jedoch an einem anderen Ort ausgeführt. höchstwahrscheinlich einen in Ihrer Crontab definierten Job .

Hiermit können Sie crontab -lcron-Jobs für Ihr Benutzerkonto auflisten und crontab -ebearbeiten.

Stellen Sie sicher, dass Sie Ihre eigene Crontab, die Crontab von Root (über Sudo) und die systemweite /etc/crontabDatei (kein spezieller Befehl für diese) überprüfen .

Du hast recht, das wusste ich nicht. Ich weiß immer noch nicht, was falsch ist, also habe ich meine Frage mit zusätzlichen Informationen bearbeitet. Danke für deinen Beitrag! moritzjacobs vor 5 Jahren 0