Hi everyone,
I set up a server with DigitalOcean (Ubuntu 16.04.4 x64) and configured it with Serverpilot. I installed two small websites on it and created the let’s encrypt certificates separately for both of them. That’s why I renew them with --webroot (Serverpilot blocks Port 80) as well as using certonly and pointing to the respective domains.
This is what I wrote in the Shell (using Putty) while testing out the right parameters:
/root/letsencrypt/letsencrypt-auto certonly --webroot --non-interactive -w /srv/users/serverpilot/apps/vielgefiel/public -d vielgefiel.com -d www.vielgefiel.com --renew-hook "sudo service nginx-sp restart"
This works fine and gives the following output:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator webroot, Installer None
Cert not yet due for renewal
Keeping the existing certificate
--------------------------------------------------------------------
Certificate not yet due for renewal; no action taken.
--------------------------------------------------------------------
Now I want to make it a daily cronjob. I opened crontab (sudo crontab -e
) and put in:
17 1 * * * /root/letsencrypt/letsencrypt-auto certonly --webroot --non-interactive -w /srv/users/serverpilot/apps/vielgefiel/public -d vielgefiel.com -d www.vielgefiel.com --renew-hook "sudo service nginx-sp restart"
This is basically the same, and I thought it might work because of the absolute path. However, I find myself wondering how to test if the cronjob was setup correctly. When I use grep CRON /var/log/syslog
I get this:
Mar 18 11:20:01 web-server CRON[20812]: (root) CMD (/root/letsencrypt/letsencrypt-auto certonly --webroot --non-interactive -w /srv/users/serverpilot/apps/vielgefiel/public -d vielgefiel.com -d www.vielgefiel.com --renew-hook "sudo service nginx-sp restart")
However, I expected to see Certificate not yet due for renewal; no action taken.
or something along those lines. How can I know that the cronjob is setup correctly? I obviously don’t want to wait until it’s too late and the certificate is expired.
I hope someone of you can advise me what to do and how to tweak the cronjob so that it works for sure.
P.S. I saw that certbot seems to be the updated version of letsencrypt. I would appreciate if someone guides me on how to update without disrupting the existing certificates, but the general question concerning the cronjob remains the same no matter which version I use.