Skip to content

Commit dabb195

Browse files
author
Serghey Rodin
committed
fixed LE status check
1 parent 47bdaeb commit dabb195

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

bin/v-check-letsencrypt-domain

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ else
110110
$BIN/v-restart-web
111111
check_result $? "Web restart failed" >/dev/null
112112
fi
113-
sleep 30
114113

115114
# Defining ACME query (request validation)
116115
query='{"resource":"challenge","type":"http-01","keyAuthorization"'
@@ -125,11 +124,18 @@ data=$data'"payload":"'"$payload"'","signature":"'"$signature"'"}'
125124
answer=$(curl -s -i -d "$data" "$uri")
126125

127126
# Checking domain validation status
128-
status=$(echo $answer |grep status |cut -f 4 -d \")
127+
i=1
128+
status=$(echo $answer |tr ',' '\n' |grep status |cut -f 4 -d \")
129129
location=$(echo "$answer" |grep Location: |awk '{print $2}' |tr -d '\r\n')
130-
while [ "$status" = 'pending' ] ; do
130+
while [ "$status" = 'pending' ]; do
131131
answer=$(curl -s -i "$location")
132+
detail="$(echo $answer |tr ',' '\n' |grep detail |cut -f 4 -d \")"
132133
status=$(echo "$answer" |tr ',' '\n' |grep status |cut -f 4 -d \")
134+
sleep 1
135+
i=$((i + 1))
136+
if [ "$i" -gt 60 ]; then
137+
check_result $E_CONNECT "$detail"
138+
fi
133139
done
134140
if [ "$status" = 'invalid' ]; then
135141
detail="$(echo $answer |tr ',' '\n' |grep detail |cut -f 4 -d \")"

0 commit comments

Comments
 (0)