Skip to content

Commit b089143

Browse files
authored
Update check_urls.sh
1 parent 1f2ccdd commit b089143

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

scripts/check_urls.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,13 @@ while IFS=: read -r filepath url; do
2525
request_id=$(curl -sS -H 'Accept: application/json' \
2626
"https://check-host.net/check-http?host=$url&max_nodes=1&node=us3.node.check-host.net" \
2727
| jq -r .request_id)
28-
sleep 5
29-
code=$(curl -sS -H 'Accept: application/json' \
30-
"https://check-host.net/check-result/$request_id" \
31-
| jq -r '.[][0][3]')
28+
for i in {1..3}; do
29+
code=$(curl -sS -H 'Accept: application/json' \
30+
"https://check-host.net/check-result/$request_id" \
31+
| jq -r -e '.[][0][3]') || code=000
32+
sleep 3
33+
done
3234
fi
33-
[[ "$code" =~ ^[0-9]+$ ]] || code=000
3435
if [ "$code" -ge 200 ] && [ "$code" -lt 400 ]; then
3536
printf "${green}%s${reset} ${cyan}%s${reset}\n" "$code" "$url"
3637
else

0 commit comments

Comments
 (0)