Skip to content

Instantly share code, notes, and snippets.

@lattmann
Last active February 18, 2016 23:29
Show Gist options
  • Save lattmann/3d0e2b9a3947e878e902 to your computer and use it in GitHub Desktop.
Save lattmann/3d0e2b9a3947e878e902 to your computer and use it in GitHub Desktop.
Renews lets encrypt certifications
#!/bin/sh
# Source is based on: https://letsencrypt.org/howitworks/#writing-your-own-renewal-script
# Latest [potentially unsafe]:
# $ sudo curl https://gist.github.com/lattmann/3d0e2b9a3947e878e902/raw/letsencrypt-renew-certs.sh -L -o /etc/cron.monthly/letsencrypt-renew-certs
# Use a fixed version:
# $ sudo curl https://gist.github.com/lattmann/3d0e2b9a3947e878e902/raw/72b3a2c955707c9f15ca53b266600bbee8f4ee06/letsencrypt-renew-certs.sh -L -o /etc/cron.monthly/letsencrypt-renew-certs
# $ sudo chmod 755 /etc/cron.monthly/letsencrypt-renew-certs
# OR
# $ curl https://gist.github.com/lattmann/3d0e2b9a3947e878e902/raw/letsencrypt-renew-certs.sh -L -o letsencrypt-renew-certs
# $ chmod 755 letsencrypt-renew-certs
# $ sudo ./letsencrypt-renew-certs
service nginx stop # or whatever your webserver is
if ! /home/ubuntu/letsencrypt/letsencrypt-auto renew -nvv --standalone > /var/log/letsencrypt/renew.log 2>&1 ; then
echo Automated renewal failed:
cat /var/log/letsencrypt/renew.log
exit 1
fi
service nginx start # or whatever your webserver is
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment