Last active
July 22, 2021 12:16
-
-
Save deanet/aa937e4c6aa3187dff887e0288443d44 to your computer and use it in GitHub Desktop.
acme-upgrade-v01-to-v02-api
This file contains hidden or 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 | |
## upgrade automatically /root/.acme.sh/ domain config on Le_API from https://acme-v01.api.letsencrypt.org/directory to https://acme-v02.api.letsencrypt.org/directory | |
## blog.dgprasetya.com | |
##upgrade acme.sh first | |
"/root/.acme.sh"/acme.sh --upgrade | |
cd /root/.acme.sh | |
tar -cvf /root/backup-acme.sh-`date +%F_%H%M`.tar /root/.acme.sh | |
## https://community.centminmod.com/threads/acmev1-deprecated-and-shutdown-june-1st-2021.21586/#post-89505 | |
find /root/.acme.sh/ -type f -name "*.csr" | while read f; | |
do | |
configname=$(echo "$f" | sed -e 's|\.csr|\.conf|g'); | |
echo "$configname"; grep '\.api' "$configname"; | |
echo; | |
if [ "$(grep "Le_API='https://acme-v01.api" $configname)" ]; | |
then | |
echo "Update Le_API in $configname"; sed -i "s|Le_API='https:\/\/acme-v01.api|Le_API='https:\/\/acme-v02.api|" "$configname"; | |
grep 'Le_API=' "$configname"; | |
echo; | |
fi; | |
done | |
##run jobs | |
"/root/.acme.sh"/acme.sh --cron --home "/root/.acme.sh" | |
service nginx reload |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment