Skip to content

Instantly share code, notes, and snippets.

@cloudrck
Last active February 20, 2017 03:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cloudrck/b6e639087cc89303e65eb83b2fca5a09 to your computer and use it in GitHub Desktop.
Save cloudrck/b6e639087cc89303e65eb83b2fca5a09 to your computer and use it in GitHub Desktop.
Renew Script for LetsEncrypt
#!/usr/bin/env bash
set -o errexit
set -o nounset
# Bash will remember & return the highest exitcode in a chain of pipes.
# This way you can catch the error in case mysqldump fails in `mysqldump |gzip`
set -o pipefail
PATH=/sbin:/bin:/usr/sbin:/usr/bin
# create new certs
for conf in $(ls /etc/letsencrypt/configs/*.conf); do
/usr/local/sbin/certbot-auto --renew-by-default --config "$conf" certonly
done
# make sure nginx picks them up
service nginx reload
# Check every two months
0 0 1 1,3,5,7,9,11 * /bin/bash /root/scripts/certbot-renew.sh >> /var/log/letsencrypt.log 2>&1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment