Tunneldigger Watchdog: Switch from debugfs to batctl o to check for mesh-vpn connectivity. Minor refractoring.
This commit is contained in:
parent
d40fd3e535
commit
31e86c9665
@ -16,20 +16,21 @@ function readPidFile()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function getNeighbourCount()
|
function getNeighbourCount()
|
||||||
local list = io.lines("/sys/kernel/debug/batman_adv/bat0/originators")
|
local handleBatctl = io.popen("batctl o", 'r')
|
||||||
if list~=nil then
|
if handleBatctl~=nil then
|
||||||
for line in list do
|
for line in handleBatctl:lines() do
|
||||||
if line:find('mesh%-vpn') then
|
if line:find('mesh%-vpn') then
|
||||||
|
handleBatctl.close()
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
handleBatctl.close()
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
local uci = require('simple-uci').cursor()
|
local uci = require('simple-uci').cursor()
|
||||||
local tunneldiggerEnabled = uci:get_bool('tunneldigger', 'mesh_vpn', 'enabled')
|
if uci:get_bool('tunneldigger', 'mesh_vpn', 'enabled') then
|
||||||
if tunneldiggerEnabled then
|
|
||||||
if io.popen("pgrep tunneldigger"):read("*l") ~= readPidFile() then
|
if io.popen("pgrep tunneldigger"):read("*l") ~= readPidFile() then
|
||||||
io.popen('logger -t tunneldigger-watchdog "Process-Pid does not match with pid-File."')
|
io.popen('logger -t tunneldigger-watchdog "Process-Pid does not match with pid-File."')
|
||||||
restartTunneldigger()
|
restartTunneldigger()
|
||||||
|
Loading…
Reference in New Issue
Block a user