blob: 2b4fabed16a7807ec4c07b9ce36ed9c4dab5f0f7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#!/usr/bin/lua
require "os"
require "io"
require "uci"
require "posix"
if posix.access("/var/run/olsrd.pid") then
local stamp, intv
local x = uci.cursor()
x:foreach("olsrd", "LoadPlugin",
function(s)
if s.library == "olsrd_watchdog.so.0.1" then
intv = tonumber(s.interval)
stamp = s.file
end
end)
if intv and posix.access(stamp) then
local systime = os.time()
local wdgtime = tonumber(io.lines(stamp)())
if not wdgtime or ( systime - wdgtime ) > intv then
os.execute("logger -t 'OLSR watchdog' 'Process died - restarting!'")
os.execute("/etc/init.d/olsrd restart")
end
end
end
|