mirror of
https://github.com/aclist/dztui.git
synced 2026-10-30 06:32:53 +01:00
fix: more robust ping method
This commit is contained in:
1 parent
90b3aa8663
commit
5393bf1f5f
1 file changed
+9
-4
+9
-4
@@ -784,12 +784,17 @@ logger(){
|
|||||||
}
|
}
|
||||||
test_ping(){
|
test_ping(){
|
||||||
shift
|
shift
|
||||||
|
local time
|
||||||
|
local res
|
||||||
local ip="$1"
|
local ip="$1"
|
||||||
local qport="$2"
|
local qport="$2"
|
||||||
local res
|
res=$(a2s $ip $qport info)
|
||||||
res=$(ping -c1 -4 -W0.5 $1 | grep time= | awk -F= '{print $4}')
|
if [[ -z $res ]]; then
|
||||||
[[ ! $? -eq 0 ]] && res="Timed out"
|
time="Timed out"
|
||||||
printf "%s" "$res"
|
else
|
||||||
|
time=$(<<< "$res" jq -r '.[].ping')
|
||||||
|
fi
|
||||||
|
printf "%s" "$time"
|
||||||
}
|
}
|
||||||
show_server_modlist(){
|
show_server_modlist(){
|
||||||
shift
|
shift
|
||||||
|
|||||||
Reference in new issue
Block a user