Last active
May 27, 2021 15:41
-
-
Save user454322/3b76136805ccb57ec1b8162bf91eb511 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
#!/usr/bin/env bash | |
#set -e | |
#openssl s_client -starttls smtp -showcerts -connect email.example.com:25 -servername email.example.com | |
#openssl x509 -in /etc/ssl/email.example.com.fullchain.pem -text | |
readonly LOG_PATH='/var/log/acme-cert-renew.log' | |
readonly DOMAIN='example.com' | |
echo '::::::::::::::::::::::' | ts | tee -a "$LOG_PATH" | |
echo 'Starting to renew cert' | ts | tee -a "$LOG_PATH" | |
rcctl -f start httpd |& ts | tee -a "$LOG_PATH" | |
echo 'Waiting..' | ts | tee -a "$LOG_PATH" | |
sleep 10 | |
/usr/sbin/acme-client -v "$DOMAIN" |& ts | tee -a "$LOG_PATH" | |
echo 'Waiting after ...' | ts | tee -a "$LOG_PATH" | |
sleep 180 | |
rcctl stop httpd |& ts | tee -a "$LOG_PATH" | |
echo 'Done renewing cert' | ts | tee -a "$LOG_PATH" | |
/etc/rc.d/smtpd restart |& ts | tee -a "$LOG_PATH" | |
tail -15 "$LOG_PATH" | mail -s "Email renewal certificate" root | |
#exit 0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment