modify script to allow multiple GET url attempts

This commit is contained in:
Daniel Valentine 2022-09-26 20:28:14 -06:00
parent 79a7954649
commit ecca464ec7

View File

@ -275,6 +275,8 @@ get ()
local url_no_scheme=
local scheme=
local zone=
local -i rc=0
local -i tries=3
local -i timeout=30
local -a curl_cmd=(curl)
@ -339,8 +341,19 @@ get ()
return 103
fi
# Do the GET.
# Do the GET. Try up to the number of times specified in the tries variable.
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]]