diff options
author | wrtbuild <wrtbuild@localhost.(none)> | 2011-10-16 07:34:24 (GMT) |
---|---|---|
committer | wrtbuild <wrtbuild@localhost.(none)> | 2011-10-16 07:34:24 (GMT) |
commit | 64ca2d1ca4e6f9ae279fc17d84b2abd453140d28 (patch) | |
tree | 84a28cd644955e52bd6b91f2c474e9f338841119 /files/common/sbin/n2n_watchdog | |
parent | 0850ac21d153d490ddc2b02f29b74b4b5ed88181 (diff) |
add makefile to generate images
Diffstat (limited to 'files/common/sbin/n2n_watchdog')
-rwxr-xr-x | files/common/sbin/n2n_watchdog | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/files/common/sbin/n2n_watchdog b/files/common/sbin/n2n_watchdog new file mode 100755 index 0000000..247753b --- /dev/null +++ b/files/common/sbin/n2n_watchdog @@ -0,0 +1,26 @@ +#!/bin/ash + +if [[ `uci get batman-adv.bat0.gw_mode` = "server" ]]; then + + n2n_pwd=`wget http://www.freifunk-jena.de/n2n -O - -q` + n2n1_pwd_old=`uci get n2n.@edge[1].key` + n2n2_pwd_old=`uci get n2n.@edge[0].key` + + if [[ $n2n_pwd != $n2n1_pwd_old && $n2n_pwd != "" -o $n2n_pwd != $n2n2_pwd_old && $n2n_pwd != "" ]]; then + uci set n2n.@edge[0].key=$n2n_pwd + uci set n2n.@edge[1].key=$n2n_pwd + uci commit n2n + /etc/init.d/n2n restart + logger "n2n password updated and restarted (new password)" + fi + + sleep 5 + n2n_neighbors=`batctl o | grep n2n | wc -l` + + if [[ $n2n_neighbors -lt 1 ]]; then + /etc/init.d/n2n restart + logger "n2n restarted (no neighbors via n2n)" + fi +else + exit 0 +fi |