Message ID | 1500642529-3627-11-git-send-email-freifunk@adrianschmutzler.de |
---|---|
State | Superseded |
Headers | show |
diff --git a/src/packages/fff/fff-autorestart/Makefile b/src/packages/fff/fff-autorestart/Makefile index b48542a..3428be7 100644 --- a/src/packages/fff/fff-autorestart/Makefile +++ b/src/packages/fff/fff-autorestart/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=fff-autorestart -PKG_VERSION:=1 +PKG_VERSION:=2 PKG_RELEASE:=1 PKG_BUILD_DIR:=$(BUILD_DIR)/fff-autorestart diff --git a/src/packages/fff/fff-autorestart/files/usr/sbin/disable_autorestart.sh b/src/packages/fff/fff-autorestart/files/usr/sbin/disable_autorestart.sh new file mode 100755 index 0000000..f422de5 --- /dev/null +++ b/src/packages/fff/fff-autorestart/files/usr/sbin/disable_autorestart.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# This disables the auto-restart feature permanently +# (settings is preserved during upgrades) + +uci -q set "fff.autorestart=settings" +uci -q set "fff.autorestart.enabled=0" + +uci -q commit fff + +if [ -s /tmp/gatewayoff ] ; then + rm -f /tmp/gatewayoff +fi +if [ -s /etc/autorestartcount ] ; then + rm -f /etc/autorestartcount +fi diff --git a/src/packages/fff/fff-autorestart/files/usr/sbin/offlinerestart b/src/packages/fff/fff-autorestart/files/usr/sbin/offlinerestart index 808ea11..51c96ee 100755 --- a/src/packages/fff/fff-autorestart/files/usr/sbin/offlinerestart +++ b/src/packages/fff/fff-autorestart/files/usr/sbin/offlinerestart @@ -1,15 +1,15 @@ #!/bin/sh +if [ "$(uci -q get fff.autorestart.enabled)" = "0" ] ; then + exit 0 +fi + UPPER_LIMIT='50' # Above this limit the gateway will be considered online LOWER_LIMIT='20' # Below this limit the gateway will be considered offline # In-between these two values the state is not changed NOW=$(date +%s) -if [ -s /tmp/gatewayoff ] && grep -q '0' /tmp/gatewayoff ; then - exit 0 -fi - GATEWAY_TQ=$(batctl gwl | grep "^=>" | awk -F'[()]' '{print $2}'| tr -d " ") # Grep the connection quality of the gateway which is currently used if [ ! "$GATEWAY_TQ" ]; # If there is no gateway there will be errors in the following if clauses then
hi hups da ist ja die von mir gewünschte Funktion nur (ich glaube) leider verkehrt herum. Ich würde mir wünschen das es Standartmäßig aus ist und vom User aktiviert werden kann. mfg Christian On 21.07.2017 15:08, Adrian Schmutzler wrote: > Auto-restart can now be disabled by a setting in the fff > config file instead of manipulating /tmp/gatewayoff. > > Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> > > Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> > --- > src/packages/fff/fff-autorestart/Makefile | 2 +- > .../fff-autorestart/files/usr/sbin/disable_autorestart.sh | 15 +++++++++++++++ > .../fff/fff-autorestart/files/usr/sbin/offlinerestart | 8 ++++---- > 3 files changed, 20 insertions(+), 5 deletions(-) > create mode 100755 src/packages/fff/fff-autorestart/files/usr/sbin/disable_autorestart.sh > > diff --git a/src/packages/fff/fff-autorestart/Makefile b/src/packages/fff/fff-autorestart/Makefile > index b48542a..3428be7 100644 > --- a/src/packages/fff/fff-autorestart/Makefile > +++ b/src/packages/fff/fff-autorestart/Makefile > @@ -1,7 +1,7 @@ > include $(TOPDIR)/rules.mk > > PKG_NAME:=fff-autorestart > -PKG_VERSION:=1 > +PKG_VERSION:=2 > PKG_RELEASE:=1 > > PKG_BUILD_DIR:=$(BUILD_DIR)/fff-autorestart > diff --git a/src/packages/fff/fff-autorestart/files/usr/sbin/disable_autorestart.sh b/src/packages/fff/fff-autorestart/files/usr/sbin/disable_autorestart.sh > new file mode 100755 > index 0000000..f422de5 > --- /dev/null > +++ b/src/packages/fff/fff-autorestart/files/usr/sbin/disable_autorestart.sh > @@ -0,0 +1,15 @@ > +#!/bin/sh > +# This disables the auto-restart feature permanently > +# (settings is preserved during upgrades) > + > +uci -q set "fff.autorestart=settings" > +uci -q set "fff.autorestart.enabled=0" > + > +uci -q commit fff > + > +if [ -s /tmp/gatewayoff ] ; then > + rm -f /tmp/gatewayoff > +fi > +if [ -s /etc/autorestartcount ] ; then > + rm -f /etc/autorestartcount > +fi > diff --git a/src/packages/fff/fff-autorestart/files/usr/sbin/offlinerestart b/src/packages/fff/fff-autorestart/files/usr/sbin/offlinerestart > index 808ea11..51c96ee 100755 > --- a/src/packages/fff/fff-autorestart/files/usr/sbin/offlinerestart > +++ b/src/packages/fff/fff-autorestart/files/usr/sbin/offlinerestart > @@ -1,15 +1,15 @@ > #!/bin/sh > > +if [ "$(uci -q get fff.autorestart.enabled)" = "0" ] ; then > + exit 0 > +fi > + > UPPER_LIMIT='50' # Above this limit the gateway will be considered online > LOWER_LIMIT='20' # Below this limit the gateway will be considered offline > # In-between these two values the state is not changed > > NOW=$(date +%s) > > -if [ -s /tmp/gatewayoff ] && grep -q '0' /tmp/gatewayoff ; then > - exit 0 > -fi > - > GATEWAY_TQ=$(batctl gwl | grep "^=>" | awk -F'[()]' '{print $2}'| tr -d " ") # Grep the connection quality of the gateway which is currently used > if [ ! "$GATEWAY_TQ" ]; # If there is no gateway there will be errors in the following if clauses > then >
Hi Grundsätzlich denke ich, ist so etwas gut. Wenn man es optionmal einschalten kann, ok. Gestern auf dem F3 Netze Camp mal wieder klar geworden, dass ein möglicher Knoten ohne Gateways beim dezentralen keyXchange (und vermutlich auch bei der lightweight Variante von Christian) regelmäßig nach Config-APs scannen muss. Ggfs könnte man das sogar mit so einer ähnlichen Funktion vereinen, dass z.B. ohne Gateways nach x-Minuten gescannt wird und bei Misserfolg ggfs rebootet wird. Tim Am Freitag, den 21.07.2017, 15:08 +0200 schrieb Adrian Schmutzler: > Auto-restart can now be disabled by a setting in the fff > config file instead of manipulating /tmp/gatewayoff. > > Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> > > Tested-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> > --- > src/packages/fff/fff-autorestart/Makefile | 2 +- > .../fff-autorestart/files/usr/sbin/disable_autorestart.sh | 15 > +++++++++++++++ > .../fff/fff-autorestart/files/usr/sbin/offlinerestart | 8 ++++- > --- > 3 files changed, 20 insertions(+), 5 deletions(-) > create mode 100755 src/packages/fff/fff- > autorestart/files/usr/sbin/disable_autorestart.sh > > diff --git a/src/packages/fff/fff-autorestart/Makefile > b/src/packages/fff/fff-autorestart/Makefile > index b48542a..3428be7 100644 > --- a/src/packages/fff/fff-autorestart/Makefile > +++ b/src/packages/fff/fff-autorestart/Makefile > @@ -1,7 +1,7 @@ > include $(TOPDIR)/rules.mk > > PKG_NAME:=fff-autorestart > -PKG_VERSION:=1 > +PKG_VERSION:=2 > PKG_RELEASE:=1 > > PKG_BUILD_DIR:=$(BUILD_DIR)/fff-autorestart > diff --git a/src/packages/fff/fff- > autorestart/files/usr/sbin/disable_autorestart.sh > b/src/packages/fff/fff- > autorestart/files/usr/sbin/disable_autorestart.sh > new file mode 100755 > index 0000000..f422de5 > --- /dev/null > +++ b/src/packages/fff/fff- > autorestart/files/usr/sbin/disable_autorestart.sh > @@ -0,0 +1,15 @@ > +#!/bin/sh > +# This disables the auto-restart feature permanently > +# (settings is preserved during upgrades) > + > +uci -q set "fff.autorestart=settings" > +uci -q set "fff.autorestart.enabled=0" > + > +uci -q commit fff > + > +if [ -s /tmp/gatewayoff ] ; then > + rm -f /tmp/gatewayoff > +fi > +if [ -s /etc/autorestartcount ] ; then > + rm -f /etc/autorestartcount > +fi > diff --git a/src/packages/fff/fff- > autorestart/files/usr/sbin/offlinerestart b/src/packages/fff/fff- > autorestart/files/usr/sbin/offlinerestart > index 808ea11..51c96ee 100755 > --- a/src/packages/fff/fff-autorestart/files/usr/sbin/offlinerestart > +++ b/src/packages/fff/fff-autorestart/files/usr/sbin/offlinerestart > @@ -1,15 +1,15 @@ > #!/bin/sh > > +if [ "$(uci -q get fff.autorestart.enabled)" = "0" ] ; then > + exit 0 > +fi > + > UPPER_LIMIT='50' # Above this limit the gateway will be considered > online > LOWER_LIMIT='20' # Below this limit the gateway will be considered > offline > # In-between these two values the state is not changed > > NOW=$(date +%s) > > -if [ -s /tmp/gatewayoff ] && grep -q '0' /tmp/gatewayoff ; then > - exit 0 > -fi > - > GATEWAY_TQ=$(batctl gwl | grep "^=>" | awk -F'[()]' '{print $2}'| tr > -d " ") # Grep the connection quality of the gateway which is > currently used > if [ ! "$GATEWAY_TQ" ]; # If there is no gateway there will be > errors in the following if clauses > then > -- > 2.7.4 >