Skip to content
Snippets Groups Projects
Commit 4323ed51 authored by rubo77's avatar rubo77
Browse files

delete emergency script

parent bc81df8a
No related branches found
No related tags found
No related merge requests found
......@@ -9,36 +9,19 @@ decides if a change of the SSID is necessary.
*It is a simplified rewrite of https://github.com/ffac/gluon-ssid-changer that doesn't check
the tx value any more. It is in use in Freifunk Freiburg*
emergency.sh
============
this repository also includes an emergency script which checks for a working batman-adv
gateway connection. If no Gateway connection exists some countermeasures are started:
- 3 min offline - call `wifi`
- 5 min offline - restart fastd
- 7 min offline - restart networking
If no countermeasure works bringing the node online again, the router will be enforced
to reboot after 10 minutes.
*Note: this script may cause a problem for users, that use the node on purposes intended
to work without functioning gateway connectivity, for example as a switch (disable
the cronjob there).*
Gluon versions
==============
This branch of the skript contains the the ssid-changer version for the gluon 2016.1.x
based on openwrt `chaos-calmer`. There is also a pre 2016.1 (barrier braker based)
version in the branch `master`. It will probably not work in 2016.2 yet.
This branch of the skript contains the the ssid-changer version for the gluon 2016.1.x. It might probably not work in 2016.2 yet.
Implement this package in your firmware
=======================================
Create a file "modules" with the following content in your
<a href="https://github.com/ffac/site/tree/offline-ssid"> site directory:</a>
GLUON_SITE_FEEDS="ssidchanger"<br>
PACKAGES_SSIDCHANGER_REPO=https://github.com/viisauksena/gluon-ssid-changer.git<br>
PACKAGES_SSIDCHANGER_COMMIT=f135ba05913feb4451e4cf067b735b095a4ee243<br>
PACKAGES_SSIDCHANGER_BRANCH=chaos-calmer<br>
Create a file "modules" with the following content in your site directory:
```
GLUON_SITE_FEEDS="ssidchanger"
PACKAGES_SSIDCHANGER_REPO=https://github.com/freifunk-nord/gluon-ssid-changer.git
PACKAGES_SSIDCHANGER_COMMIT=bc81df8a5a3e19c524f0ea9ede3ae4ab79bb01fd
PACKAGES_SSIDCHANGER_BRANCH=master
```
With this done you can add the package gluon-ssid-changer to your site.mk
#!/bin/sh
# set some sysctl
# see kernel.org/doc/Documentation/sysctl/vm.txt
# sysctl -w vm.panic_on_oom=0 # deact reboot on oom
# sysctl -w kernel.panic=80 # 80s after panic reboot
# sysctl -w vm.overcommit_memory=2 # calc if enough mem is avail mmaloc
# echo 100 > /proc/sys/vm/overcommit_ratio # max % useable mem
# echo 0 > /proc/sys/vm/user_reserve_kbytes # only root need reserve
# echo 128 > /proc/sys/vm/lowmem_reserve_ratio
# raise prob. of proc to kill
# echo 10 > /proc/$(cat /var/run/fastd.mesh_vpn.pid)/oom_adj # deprecated
echo 700 > /proc/$(pgrep fastd)/oom_score_adj # fastd
echo 900 > /proc/$(pgrep ntp)/oom_score_adj # ntp
echo 950 > /proc/$(pgrep /usr/sbin/batadv-vis)/oom_score_adj # batvis
# if we see bat GW just exit
netz=$(batctl gwl -H|grep -v "gateways in range"|wc -l)
if [ $netz -ne 0 ] ; then
echo "$0 found GW in network, exiting"
echo 0 > /tmp/emergency
exit 0
fi
# see ath9k for stopped
# cat /sys/kernel/debug/ieee80211/phy0/ath9k/queues
# simple counter
touch /tmp/emergency
counter=$(cat /tmp/emergency)
if [ -z $counter ] ; then counter=0 ; fi
if [ $counter -lt 10 ]
then
let counter+=1
echo $counter > /tmp/emergency
if [ $counter -eq 3 ]; then echo "$0 - 3 min offline - try wifi"|logger; wifi ; fi
if [ $counter -eq 5 ]; then echo "$0 - 5 min offline - try restart fastd"|logger; /etc/init.d/fastd restart ; fi
if [ $counter -eq 7 ]; then echo "$0 - 7 min offline - try restart network"|logger; /etc/init.d/network restart ; fi
else reboot
fi
echo $counter
* * * * * /lib/gluon/ssid-changer/emergency.sh
12 * * * * iwinfo phy0 scan
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment