mirror of
https://github.com/Websoft9/websoft9.git
synced 2025-02-03 01:28:39 +08:00
time
This commit is contained in:
parent
76f952e1c5
commit
0d43e8832d
@ -306,26 +306,19 @@ sudo systemctl restart cockpit
|
|||||||
}
|
}
|
||||||
|
|
||||||
function fastest_url() {
|
function fastest_url() {
|
||||||
urls=("$@")
|
urls=("$@")
|
||||||
fastest_url=""
|
fastest_url=""
|
||||||
fastest_time=0
|
fastest_time=0
|
||||||
|
|
||||||
for url in "${urls[@]}"; do
|
for url in "${urls[@]}"; do
|
||||||
total_time=0
|
time=$(curl -s -w '%{time_total}\n' -o /dev/null $url)
|
||||||
for i in {1..5}; do
|
if (( $(echo "$time < $fastest_time || $fastest_time == 0" | bc -l) )); then
|
||||||
time=$(curl -s -w '%{time_total}\n' -o /dev/null $url)
|
fastest_time=$time
|
||||||
total_time=$(echo "$total_time + $time" | bc -l)
|
fastest_url=$url
|
||||||
done
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
avg_time=$(echo "$total_time / 5" | bc -l)
|
echo "$fastest_url"
|
||||||
|
|
||||||
if (( $(echo "$avg_time < $fastest_time || $fastest_time == 0" | bc -l) )); then
|
|
||||||
fastest_time=$avg_time
|
|
||||||
fastest_url=$url
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "$fastest_url"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function clone_repo() {
|
function clone_repo() {
|
||||||
|
Loading…
Reference in New Issue
Block a user