Auto renewals with Let's Encrypt on Ubuntu 14.04
Warning: This post is over a year old. The information may be out of date.
I have automatic renewals for Let’s Encrypt set up as per the Digital Ocean guide on Ubuntu 14.04 - I recently changed it slightly, here’s how!
Digital Ocean have fantastic guides on so many topics, I used their guide on how to secure Apache with Let’s Encrypt on Ubuntu 14.04 and in Step 4 they mention how to set up automatic renewals using the renew
option of letsencrypt-auto
I’ve updated the way I’m doing renewals by adding the following script in /scripts/letsencrypt-renew.sh
#!/bin/bash
/opt/certbot-auto renew --no-self-upgrade --renew-hook='sudo service apache2 restart' >> /var/log/le-renew.log
(and running chmod +x /scripts/letsencrypt-renew.sh
to make it executable)
And changing the cron to run:
47 4 * * 1 /scripts/letsencrypt-renew.sh >> /var/log/le-renew.log
Now at 4:47am on a Monday it’ll renew any certs it needs to, and then restart Apache only if it renews a certificate.
Job done.