first commit
This commit is contained in:
36
lua/old/script_time_ping_perf.old
Executable file
36
lua/old/script_time_ping_perf.old
Executable file
@@ -0,0 +1,36 @@
|
||||
require "scripts/lua/functions"
|
||||
|
||||
commandArray = {}
|
||||
|
||||
|
||||
--recupere les minutes
|
||||
time=os.time()
|
||||
minutes=tonumber(os.date('%M',time))
|
||||
|
||||
if (minutes % 10 == 0 ) then
|
||||
local f = io.popen("ping -c 5 192.168.0.1 2>/dev/null |grep rtt |awk -F = '{print $2}'|awk -F / '{print $2}'") -- runs command
|
||||
local l = f:read("*a") -- read output of command
|
||||
debug("##### Perf ping : temps de ping "..l)
|
||||
f:close()
|
||||
-- Perf Reseau
|
||||
commandArray['UpdateDevice']="145|0|"..l
|
||||
end
|
||||
|
||||
if (minutes % 30 == 0 ) then
|
||||
local f = io.popen("ping -c 4 -n www.free.fr|grep packet|awk -F ' ' '{print $1}'") -- runs command
|
||||
local l = f:read("*a") -- read output of command
|
||||
debug("##### Nombre de ping: "..l)
|
||||
f:close()
|
||||
if (l == "4") then
|
||||
debug("##### Internet fonctionne correctement")
|
||||
switchIfNeeded('Internet','On')
|
||||
else
|
||||
debug("##### Internet ne répond pas")
|
||||
switchIfNeeded('Internet','Off')
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
return commandArray
|
||||
|
||||
Reference in New Issue
Block a user