mirror of
https://github.com/redlib-org/redlib-instances.git
synced 2024-11-13 18:06:15 -05:00
modify script to allow multiple GET url attempts
This commit is contained in:
parent
79a7954649
commit
ecca464ec7
@ -275,6 +275,8 @@ get ()
|
|||||||
local url_no_scheme=
|
local url_no_scheme=
|
||||||
local scheme=
|
local scheme=
|
||||||
local zone=
|
local zone=
|
||||||
|
local -i rc=0
|
||||||
|
local -i tries=3
|
||||||
local -i timeout=30
|
local -i timeout=30
|
||||||
local -a curl_cmd=(curl)
|
local -a curl_cmd=(curl)
|
||||||
|
|
||||||
@ -339,8 +341,19 @@ get ()
|
|||||||
return 103
|
return 103
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Do the GET.
|
# Do the GET. Try up to the number of times specified in the tries variable.
|
||||||
"${curl_cmd[@]}" -m"${timeout}" -fsL -- "${scheme}://${url_no_scheme}"
|
for (( i = tries; i > 0; i-- ))
|
||||||
|
do
|
||||||
|
"${curl_cmd[@]}" -m"${timeout}" -fsL -- "${scheme}://${url_no_scheme}"
|
||||||
|
rc=$?
|
||||||
|
|
||||||
|
if [[ ${rc} -eq 0 ]]
|
||||||
|
then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
return ${rc}
|
||||||
}
|
}
|
||||||
|
|
||||||
# create_instance_entry [-T] URL COUNTRY_CODE [CLOUDFLARE [DESCRIPTION]]
|
# create_instance_entry [-T] URL COUNTRY_CODE [CLOUDFLARE [DESCRIPTION]]
|
||||||
|
Loading…
Reference in New Issue
Block a user