Skip to content

Commit 3d364bb

Browse files
authored
Update check_urls.sh
1 parent 9ecfb87 commit 3d364bb

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

scripts/check_urls.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,6 @@
55
# This source code is licensed under the BSD-style license found in the
66
# LICENSE file in the root directory of this source tree.
77

8-
set -x
9-
10-
url="https://www.cadence.com/en_US/home.html"
11-
request_id=$(curl -sS -H 'Accept: application/json' \
12-
"https://check-host.net/check-http?host=$url&max_nodes=1&node=us3.node.check-host.net" \
13-
| jq -r .request_id)
14-
curl -sS -H 'Accept: application/json' "https://check-host.net/check-result/$request_id"
15-
168
set -euo pipefail
179

1810
status=0
@@ -29,6 +21,15 @@ while IFS=: read -r filepath url; do
2921
if [ "$code" -ge 400 ]; then
3022
code=$(curl -gsLm30 -o /dev/null -w "%{http_code}" -r 0-0 -A "$user_agent" "$url") || code=000
3123
fi
24+
if [ "$code" -ge 400 ]; then
25+
request_id=$(curl -sS -H 'Accept: application/json' \
26+
"https://check-host.net/check-http?host=$url&max_nodes=1&node=us3.node.check-host.net" \
27+
| jq -r .request_id)
28+
code=$(curl -sS -H 'Accept: application/json' \
29+
"https://check-host.net/check-result/$request_id" \
30+
| jq -r '."us3.node.check-host.net"[0][3]' 2>/dev/null)
31+
fi
32+
[[ "$code" =~ ^[0-9]+$ ]] || code=000
3233
if [ "$code" -ge 200 ] && [ "$code" -lt 400 ]; then
3334
printf "${green}%s${reset} ${cyan}%s${reset}\n" "$code" "$url"
3435
else

0 commit comments

Comments
 (0)