Last active
September 4, 2018 02:36
-
-
Save betapcode/fb906d2757bad1c071cbf71e5586bfe8 to your computer and use it in GitHub Desktop.
Simple Certbot (Let's Encrypt) script for auto-renewal certificates
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 | |
# Source | |
# https://gist.github.com/betapcode/fb906d2757bad1c071cbf71e5586bfe8 | |
# Make sure this is added to the crontab, ie: | |
# sudo crontab -e | |
# MAILTO="[email protected]" | |
# 30 2 * */3 * /opt/certbot-renew.sh | |
# Config | |
web_service="nginx"; | |
le_path="/opt"; | |
# Stop nginx service | |
echo "Stop $web_service" | |
/sbin/service $web_service stop | |
# Update the cert | |
echo "The certificate for domain is about to expire. Starting renewal script..." | |
$le_path/certbot-auto renew | |
# Start our service | |
echo "Start $web_service" | |
/sbin/service $web_service start |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment