|
@@ -77,7 +77,13 @@ function fastest_url() {
|
|
|
fastest_time=0
|
|
|
|
|
|
for url in "${urls[@]}"; do
|
|
|
- time=$(curl -s -w '%{time_total}\n' -o /dev/null $url)
|
|
|
+ if curl --output /dev/null --silent --head --fail "$url"; then
|
|
|
+ echo $url" is available"
|
|
|
+ else
|
|
|
+ echo $url" is not available"
|
|
|
+ continue
|
|
|
+ fi
|
|
|
+ time=$(curl --connect-timeout 3 -s -w '%{time_total}\n' -o /dev/null $url)
|
|
|
if (( $(echo "$time < $fastest_time || $fastest_time == 0" | bc -l) )); then
|
|
|
fastest_time=$time
|
|
|
fastest_url=$url
|