Serghey Rodin 9 лет назад
Родитель
Сommit
dabb19573c
1 измененных файлов с 9 добавлено и 3 удалено
  1. 9 3
      bin/v-check-letsencrypt-domain

+ 9 - 3
bin/v-check-letsencrypt-domain

@@ -110,7 +110,6 @@ else
     $BIN/v-restart-web
     $BIN/v-restart-web
     check_result $? "Web restart failed" >/dev/null
     check_result $? "Web restart failed" >/dev/null
 fi
 fi
-sleep 30
 
 
 # Defining ACME query (request validation)
 # Defining ACME query (request validation)
 query='{"resource":"challenge","type":"http-01","keyAuthorization"'
 query='{"resource":"challenge","type":"http-01","keyAuthorization"'
@@ -125,11 +124,18 @@ data=$data'"payload":"'"$payload"'","signature":"'"$signature"'"}'
 answer=$(curl -s -i -d "$data" "$uri")
 answer=$(curl -s -i -d "$data" "$uri")
 
 
 # Checking domain validation status
 # Checking domain validation status
-status=$(echo $answer |grep status |cut -f 4 -d \")
+i=1
+status=$(echo $answer |tr ',' '\n' |grep status |cut -f 4 -d \")
 location=$(echo "$answer" |grep Location: |awk '{print $2}' |tr -d '\r\n')
 location=$(echo "$answer" |grep Location: |awk '{print $2}' |tr -d '\r\n')
-while [ "$status" = 'pending' ] ; do
+while [ "$status" = 'pending' ]; do
     answer=$(curl -s -i "$location")
     answer=$(curl -s -i "$location")
+    detail="$(echo $answer |tr ',' '\n' |grep detail |cut -f 4 -d \")"
     status=$(echo "$answer" |tr ',' '\n' |grep status |cut -f 4 -d \")
     status=$(echo "$answer" |tr ',' '\n' |grep status |cut -f 4 -d \")
+    sleep 1
+    i=$((i + 1))
+    if [ "$i" -gt 60 ]; then
+        check_result $E_CONNECT "$detail"
+    fi
 done
 done
 if [ "$status" = 'invalid' ]; then
 if [ "$status" = 'invalid' ]; then
     detail="$(echo $answer |tr ',' '\n' |grep detail |cut -f 4 -d \")"
     detail="$(echo $answer |tr ',' '\n' |grep detail |cut -f 4 -d \")"