Last active
January 15, 2020 08:39
-
-
Save gomasy/49437c592ae2c09f2d38ecbb167b1acd 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 | |
declare -A prev | |
declare -A next | |
renewal=0 | |
domain=("gomasy.jp" "gomasy.net") | |
for d in ${domain[@]}; do | |
prev+=([$d]=`date -r /etc/letsencrypt/live/$d/cert.pem "+%s"`) | |
done | |
certbot renew | |
for d in ${domain[@]}; do | |
next+=([$d]=`date -r /etc/letsencrypt/live/$d/cert.pem "+%s"`) | |
if [[ ${prev[$d]} -ne ${next[$d]} ]]; then | |
cat /etc/letsencrypt/live/$d/chain.pem /etc/ssl/certs/DST_Root_CA_X3.pem > /etc/ssl/certs/$d-ca-certs.crt | |
renewal=1 | |
fi | |
done | |
if [[ $renewal -eq 1 ]]; then | |
openssl rand -out /etc/ssl/private/ticket.key 80 | |
systemctl restart nginx | |
systemctl restart postfix | |
systemctl restart dovecot | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment