mirror of
https://github.com/Websoft9/websoft9.git
synced 2024-11-22 15:40:22 +00:00
fasturl improve
This commit is contained in:
parent
c5edc4254d
commit
1d81684850
2 changed files with 13 additions and 1 deletions
|
@ -322,6 +322,12 @@ function fastest_url() {
|
|||
fastest_time=0
|
||||
|
||||
for url in "${urls[@]}"; do
|
||||
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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue