Created
January 10, 2017 09:38
-
-
Save stefanorg/53b23953f48fd660d6ed38c5b1562e51 to your computer and use it in GitHub Desktop.
letsencrypt cert auto renewal example
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
*************************************** | |
* /usr/bin/letsencrypt-example.com.sh * | |
* rif: https://community.letsencrypt.org/t/multiple-domains-webroot-paths-using-webroot-plugin/7982/5 | |
*************************************** | |
# Settings | |
DOMAIN=example.com | |
TIMESTAMP=$(date +"%F %T") | |
# Execute | |
/etc/letsencrypt/letsencrypt-auto certonly -t --renew-by-default --test-cert \ | |
-w /var/www/www.$DOMAIN/ -d $DOMAIN -d www.$DOMAIN \ | |
-w /var/www/admin.$DOMAIN/ -d admin.$DOMAIN -d adm.$DOMAIN \ | |
-w /var/www/api.$DOMAIN/ -d api.$DOMAIN | |
# Log and restart web server | |
if [ $? -ne 0 ] | |
then | |
echo "["$TIMESTAMP"] Cert for "$DOMAIN" could NOT be renewed!" >> /var/log/letsencrypt/sh-renewals.log | |
else | |
echo "["$TIMESTAMP"] Cert for "$DOMAIN" renewed!" >> /var/log/letsencrypt/sh-renewals.log | |
service apache2 reload | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment