diff options
Diffstat (limited to 'contrib/package/freifunk-common/files/usr')
4 files changed, 62 insertions, 0 deletions
diff --git a/contrib/package/freifunk-common/files/usr/bin/ffdzero b/contrib/package/freifunk-common/files/usr/bin/ffdzero new file mode 100755 index 0000000000..24e8c2e181 --- /dev/null +++ b/contrib/package/freifunk-common/files/usr/bin/ffdzero @@ -0,0 +1,10 @@ +#!/bin/sh + +test "$1" = "-h" && echo -e "Usage:\n\t$0 -h\n\t$0 [ { ip | hostname } ]" >&2 && exit 1 + +host="${1:-leipzig.freifunk.net}" + +wget -O /dev/null http://$host/cgi-bin-dev-zero.bin +test "$?" = "1" && wget -O /dev/null http://$host/cgi-bin/dev-zero.bin +test "$?" = "1" && wget -O /dev/null http://$host/cgi-bin/luci/freifunk/status/zeroes +test "$?" = "1" && echo "$host: no zero download found..." && exit 1 diff --git a/contrib/package/freifunk-common/files/usr/bin/neigh.sh b/contrib/package/freifunk-common/files/usr/bin/neigh.sh new file mode 100755 index 0000000000..723b813b76 --- /dev/null +++ b/contrib/package/freifunk-common/files/usr/bin/neigh.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +wget -q -O - http://localhost:2006/neighbours|sed -e's/LinkQuality/LQ/;s/Hysteresis/Hyst./;s/Willingness/Will./' diff --git a/contrib/package/freifunk-common/files/usr/sbin/ff_olsr_watchdog b/contrib/package/freifunk-common/files/usr/sbin/ff_olsr_watchdog new file mode 100755 index 0000000000..aa8de61622 --- /dev/null +++ b/contrib/package/freifunk-common/files/usr/sbin/ff_olsr_watchdog @@ -0,0 +1,29 @@ +#!/usr/bin/lua + +require "os" +require "io" +require "uci" +local fs = require "nixio.fs" + +if fs.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 fs.access(stamp) then + local systime = os.time() + local wdgtime = tonumber(io.lines(stamp)()) + + if not wdgtime or ( systime - wdgtime ) > ( intv * 2 ) then + os.execute("logger -t 'OLSR watchdog' 'Process died - restarting!'") + os.execute("/etc/init.d/olsrd restart") + end + end +end diff --git a/contrib/package/freifunk-common/files/usr/sbin/ff_rdate b/contrib/package/freifunk-common/files/usr/sbin/ff_rdate new file mode 100755 index 0000000000..dc2c7b2d2c --- /dev/null +++ b/contrib/package/freifunk-common/files/usr/sbin/ff_rdate @@ -0,0 +1,20 @@ +#!/bin/sh + +uci_get_one() { + for var in "$@"; do + uci -P /var/state get "$var" 2>/dev/null && break + done +} + +local servers="$(uci_get_one 'network.wan.lease_timesrv') $(uci show timeserver | sed -ne 's/.*hostname=//p')" + +if [ -n "$servers" ]; then + for server in $servers; do + rdate -s $server >/dev/null 2>/dev/null && \ + logger -t rdate "Synced with $server" && break + + logger -t rdate "Failed to sync with $server" + done +else + logger -t rdate "No usable time server found" +fi |