mirror of
https://github.com/fw876/helloworld.git
synced 2026-12-06 00:01:06 +00:00
luci-app-ssr-plus: update ping value displayed integer.
This commit is contained in:
1 parent
6b8211c530
commit
ca3d7071ea
1 file changed
+5
-1
@@ -98,10 +98,14 @@ function act_ping()
|
||||
end
|
||||
|
||||
if not e.ping then
|
||||
e.ping = tonumber(luci.sys.exec(string.format(
|
||||
local ping_result = tonumber(luci.sys.exec(string.format(
|
||||
"nping --udp -c 1 -p %d %s 2>/dev/null | grep -o 'Avg rtt: [0-9.]*ms' | awk '{print $3}' | sed 's/ms//' | head -1",
|
||||
port, domain
|
||||
)))
|
||||
local ping_num = tonumber(ping_result)
|
||||
if ping_num then
|
||||
e.ping = math.floor(ping_num)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in new issue
Block a user