Created
February 10, 2017 18:30
-
-
Save chappjc/c4b116d385bb7344cdc45cbfef38c68f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
/usr/local/letsencrypt/certbot-auto renew --noninteractive --standalone \ | |
--pre-hook "systemctl stop nginx" --post-hook "systemctl start nginx" \ | |
--renew-hook "touch /etc/nginx/ssl/certsrenewed" --quiet --no-self-upgrade | |
EXITVAL=$? | |
if [ $EXITVAL -ne 0 ]; then | |
/usr/bin/logger -t certbot "certbot-auto exited abnormally with $EXITVAL" | |
exit $EXITVAL | |
fi | |
if [ -f /etc/nginx/ssl/certsrenewed ]; then | |
/usr/bin/logger -t certbot "certbot-auto just renewed HTTPS/SSL certificates" | |
# Link to /etc/letsencrypt/live... or copy the cert/keys: | |
# cp /etc/letsencrypt/live/whatever.net/fullchain.pem /etc/nginx/ssl/whatever.net.crt | |
# cp /etc/letsencrypt/live/whatever.net/privkey.pem /etc/nginx/ssl/whatever.net.key | |
rm /etc/nginx/ssl/certsrenewed | |
else | |
/usr/bin/logger -t certbot "certbot-auto exited cleanly ($EXITVAL), no renewal necessary" | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment