Refactor start.letsencrypt.sh to correct installation check logic and improve domain file handling
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -54,7 +54,7 @@ create_json() {
|
||||
|
||||
start_letsencrypt() {
|
||||
cd /root
|
||||
if [ "$LETSENCRYPT_INSTALLED" == "true" ]; then
|
||||
if [ "$LETSENCRYPT_INSTALLED" != "true" ]; then
|
||||
curl https://get.acme.sh | sh -s email=$EMAIL
|
||||
LETSENCRYPT_INSTALLED=true
|
||||
fi
|
||||
@@ -110,7 +110,6 @@ check_new_cert() {
|
||||
}
|
||||
|
||||
LETSENCRYPT_FILES=$(find /acme.sh/ -type f -name letsencrypt)
|
||||
echo "letsencrypt files exist"
|
||||
|
||||
if [ "$DOMAIN" != "localhost" ]; then
|
||||
if [ ! -f $LETSENCRYPT_OUTPUT ]; then
|
||||
@@ -128,6 +127,7 @@ if [ "$DOMAIN" != "localhost" ]; then
|
||||
fi
|
||||
|
||||
elif [ -n "$LETSENCRYPT_FILES" ]; then
|
||||
echo "letsencrypt files exist"
|
||||
for LETSENCRYPT_FILE in $(echo $LETSENCRYPT_FILES); do
|
||||
DOMAIN=$(jq -r .DOMAIN $LETSENCRYPT_FILE)
|
||||
echo "DOMAIN: $DOMAIN"
|
||||
@@ -142,10 +142,9 @@ if [ "$DOMAIN" != "localhost" ]; then
|
||||
else
|
||||
DOMAIN_FILE=""
|
||||
echo "no any new created domain exists try renew all"
|
||||
for D in $(ls /domains); do
|
||||
echo "D: $D"
|
||||
DOMAIN_FILE=$(basename $D)
|
||||
echo "DOMAIN_FILE: $DOMAIN_FILE"
|
||||
for DOMAIN_FILE in $(ls /domains); do
|
||||
cd /domains
|
||||
echo "DOMAIN_FILE: $(basename $DOMAIN_FILE)"
|
||||
DOMAIN=$(jq -r .DOMAIN $DOMAIN_FILE)
|
||||
echo "DOMAIN: $DOMAIN"
|
||||
if [ "$DOMAIN" != "localhost" ]; then
|
||||
@@ -153,8 +152,6 @@ if [ "$DOMAIN" != "localhost" ]; then
|
||||
start_letsencrypt $DOMAIN
|
||||
check_new_cert
|
||||
fi
|
||||
DOMAIN=""
|
||||
DOMAIN_FILE=""
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
Reference in New Issue
Block a user