From: Jo-Philipp Wich Date: Mon, 16 Mar 2009 17:36:00 +0000 (+0000) Subject: modules/freifunk: add olsrd watchdog script, remove olsrd interface defaults X-Git-Tag: 0.9.0~589 X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=commitdiff_plain;h=bb48f0b5c544907661f79cf5fdd6e3809125805d;hp=129be80785b60b8e4bda7be8a211c1716a29f27a modules/freifunk: add olsrd watchdog script, remove olsrd interface defaults --- diff --git a/modules/freifunk/root/etc/config/freifunk b/modules/freifunk/root/etc/config/freifunk index 862c86dbb..c8eeee223 100644 --- a/modules/freifunk/root/etc/config/freifunk +++ b/modules/freifunk/root/etc/config/freifunk @@ -76,14 +76,6 @@ config defaults dhcp config defaults olsr_interface - option HelloInterval 6.0 - option HelloValidityTime 108.0 - option TcInterval 4.0 - option TcValidityTime 324.0 - option MidInterval 18.0 - option MidValidityTime 324.0 - option HnaInterval 18.0 - option HnaValidityTime 108.0 config community leipzig diff --git a/modules/freifunk/root/etc/init.d/freifunk b/modules/freifunk/root/etc/init.d/freifunk index 61bd58055..a61f8b7a1 100755 --- a/modules/freifunk/root/etc/init.d/freifunk +++ b/modules/freifunk/root/etc/init.d/freifunk @@ -13,6 +13,10 @@ boot() { echo "* * * * * /usr/sbin/ff_olsr_test_gw" >> /etc/crontabs/root } + grep -q '/usr/sbin/ff_olsr_watchdog' /etc/crontabs/root || { + echo "*/5 * * * * /usr/sbin/ff_olsr_watchdog" >> /etc/crontabs/root + } + [ -f /etc/rc.local ] && . /etc/rc.local [ -d /etc/rc.local.d ] && { for file in /etc/rc.local.d/*; do 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 000000000..2b4fabed1 --- /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