Last active
January 1, 2016 17:55
-
-
Save dstokes/f99a5f49fe8e97fa71de 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/bash | |
# | |
# Update SSL certs with letsencrypt | |
# | |
LE_HOME=/usr/src/letsencrypt | |
# stop nginx temporarily | |
echo "Stopping nginx" | |
systemctl stop nginx | |
# write cert to /etc/letsencrypt/live/my.domain.com/ | |
$LE_HOME/letsencrypt-auto certonly \ | |
--standalone \ | |
--standalone-supported-challenges tls-sni-01 \ | |
--renew-by-default \ | |
-d my.domain.com | |
EXIT_CODE=0 | |
if [[ $? -ne 0 ]]; then | |
echo "Failed to generate new SSL cert" | |
EXIT_CODE=1 | |
fi | |
echo "Starting nginx" | |
systemctl start nginx | |
exit $EXIT_CODE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment