Hi
I have installed certbot from snap as recommended and generated my first certificates. I run certbot with certonly and DNS authenticator plugin (dns-domeneshop). When I manually run a renew command which checks and eventually renews the certificates, everything seems to work fine as well. But when I set up the very same command as a cron job for root user, it fails.
How can I set up cron job so certificates can renew automatically?
My domain is:
infinitum.no
I ran this command:
sudo crontab -e
-
-
-
-
- /bin/bash -c "date >> /var/log/letsencrypt/renew.log; /usr/local/bin/certbot --version >> /var/log/letsencrypt/renew.log; /usr/local/bin/certbot renew >> /var/log/letsencrypt/renew.log"
-
-
-
The line above is the content of crontab for the root user. Apparently, the command logs the date and version in custom log file (renew.log) and finally tries to renew all letsencrypt certificates.
It produced this output:
(since command i run from crontab, this is output from the custom log file, renew.log)
Tue Apr 27 23:36:01 UTC 2021
Tue Apr 27 23:37:01 UTC 2021
Tue Apr 27 23:38:01 UTC 2021
Tue Apr 27 23:39:01 UTC 2021
Tue Apr 27 23:40:01 UTC 2021
(so nothing but the date command is logged. Renewal is not being attempted!)
I ran this command:
sudo /bin/bash -c "date >> /var/log/letsencrypt/renew.log; /usr/local/bin/certbot --version >> /var/log/letsencrypt/renew.log; /usr/local/bin/certbot renew >> /var/log/letsencrypt/renew.log"
It produced this output:
(output from the custom log file, renew.log)
Tue Apr 27 23:44:49 UTC 2021
certbot 1.14.0
Processing /etc/letsencrypt/renewal/dev.infinitum.no.conf
Processing /etc/letsencrypt/renewal/infinitum.no.conf
Processing /etc/letsencrypt/renewal/test.infinitum.no.conf
The following certificates are not due for renewal yet:
/etc/letsencrypt/live/dev.infinitum.no/fullchain.pem expires on 2021-07-25 (skipped)
/etc/letsencrypt/live/infinitum.no/fullchain.pem expires on 2021-07-25 (skipped)
/etc/letsencrypt/live/test.infinitum.no/fullchain.pem expires on 2021-07-25 (skipped)
No renewals were attempted.
My web server is (include version):
I do not use installer certbot plugin and have no running web server on my certbot linux server. Generated certificates are taken to production by one hook script.
The operating system my web server runs on is (include version):
Ubuntu Linux 18.04.5 LTS (Bionic Beaver)
My hosting provider, if applicable, is:
domeneshop
I can login to a root shell on my machine (yes or no, or I don't know):
Yes
I'm using a control panel to manage my site (no, or provide the name and version of the control panel):
No
The version of my client is (e.g. output of certbot --version
or certbot-auto --version
if you're using Certbot):
1.14.0