summaryrefslogtreecommitdiffhomepage
path: root/modules/freifunk/root/usr
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2009-03-16 17:36:00 +0000
committerJo-Philipp Wich <jow@openwrt.org>2009-03-16 17:36:00 +0000
commitbb48f0b5c544907661f79cf5fdd6e3809125805d (patch)
treece71071e520fcba0f06fcf9185cb7ead95c8bd4b /modules/freifunk/root/usr
parent129be80785b60b8e4bda7be8a211c1716a29f27a (diff)
modules/freifunk: add olsrd watchdog script, remove olsrd interface defaults
Diffstat (limited to 'modules/freifunk/root/usr')
-rwxr-xr-xmodules/freifunk/root/usr/sbin/ff_olsr_watchdog29
1 files changed, 29 insertions, 0 deletions
diff --git a/modules/freifunk/root/usr/sbin/ff_olsr_watchdog b/modules/freifunk/root/usr/sbin/ff_olsr_watchdog
new file mode 100755
index 0000000000..2b4fabed16
--- /dev/null
+++ b/modules/freifunk/root/usr/sbin/ff_olsr_watchdog
@@ -0,0 +1,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