Tunneldigger-Watchdog: Refractoring, move import to the top

This commit is contained in:
Matthias P. Walther 2019-06-04 22:59:26 +02:00
parent 31335089a2
commit 021080c094
No known key found for this signature in database
GPG Key ID: 16BA5AB30324A4AE

View File

@ -1,5 +1,7 @@
#!/usr/bin/lua
local uci = require('simple-uci').cursor()
function restart_tunneldigger()
io.popen('logger -t tunneldigger-watchdog "Restarting Tunneldigger."')
os.execute('/etc/init.d/tunneldigger restart')
@ -30,7 +32,6 @@ function has_mesh_vpn_neighbours()
return false
end
local uci = require('simple-uci').cursor()
if uci:get_bool('tunneldigger', 'mesh_vpn', 'enabled') then
if io.popen('pgrep tunneldigger'):read('*l') ~= read_pid_file() then
io.popen('logger -t tunneldigger-watchdog "Process-Pid does not match with pid-File."')