[RFC PATCH v4 10/11] fff-autorestart: Add fff config option to disable

Christian Dresel fff at chrisi01.de
So Aug 20 12:22:08 CEST 2017


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 at adrianschmutzler.de>
> 
> Tested-by: Adrian Schmutzler <freifunk at 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
> 

-------------- nächster Teil --------------
Ein Dateianhang mit Binärdaten wurde abgetrennt...
Dateiname   : signature.asc
Dateityp    : application/pgp-signature
Dateigröße  : 819 bytes
Beschreibung: OpenPGP digital signature
URL         : <http://lists.freifunk.net/pipermail/franken-dev-freifunk.net/attachments/20170820/7d4e6893/attachment.sig>


Mehr Informationen über die Mailingliste franken-dev