diff --git a/ffac-ssid-changer/README.md b/ffac-ssid-changer/README.md index 1c4e6836..f12231ee 100644 --- a/ffac-ssid-changer/README.md +++ b/ffac-ssid-changer/README.md @@ -41,7 +41,7 @@ Adapt and add this block to your `site.conf`: ssid_changer = { enabled = true, - switch_timeframe = 30, -- only once every timeframe (in minutes) the SSID will change to the Offline-SSID + switch_timeframe = 30, -- only once every timeframe (in minutes) the SSID will change to the Offline-SSID -- set to 1440 to change once a day -- set to 1 minute to change every time the router gets offline first = 5, -- the first few minutes directly after reboot within which an Offline-SSID may be @@ -102,4 +102,4 @@ Some SSID changers are in use in: - Freifunk Vogtland - [Freifunk Berlin](https://github.com/freifunk-berlin/falter-packages/tree/master/packages/falter-berlin-ssid-changer) - [Freifunk Stuttgart](https://gitlab.freifunk-stuttgart.de/firmware/gluon-packages.git) -- [Freifunk Altdorf](https://github.com/tecff/gluon-packages/tree/main/tecff-ssid-changer) \ No newline at end of file +- [Freifunk Altdorf](https://github.com/tecff/gluon-packages/tree/main/tecff-ssid-changer) diff --git a/ffac-ssid-changer/shsrc/ssid-changer.sh b/ffac-ssid-changer/shsrc/ssid-changer.sh index f8b80fdb..ca4164b7 100755 --- a/ffac-ssid-changer/shsrc/ssid-changer.sh +++ b/ffac-ssid-changer/shsrc/ssid-changer.sh @@ -30,7 +30,7 @@ PREFIX="$(uci -q get ssid-changer.settings.prefix)" PREFIX_OWE="$(uci -q get ssid-changer.settings.prefix_owe)" : ${PREFIX_OWE:='FF_Off_OWE'} -if [ "$(uci -q get ssid-changer.settings.enabled)" = '0' ]; then +if [ "$(uci -q get ssid-changer.settings.enabled)" = '0' ]; then DISABLED='1' else DISABLED='0' @@ -122,7 +122,7 @@ if [ "$CHECK" -gt 0 ] || [ "$DISABLED" = '1' ]; then LOOP=1 # check status for all physical devices for HOSTAPD in $(ls /var/run/hostapd-phy*); do - ONLINE_SSID="$(echo $ONLINE_SSIDs | awk -F '~' -v l=$((LOOP*2)) '{print $l}')" + ONLINE_SSID="$(echo $ONLINE_SSIDs | awk -F '~' -v l=$((LOOP*2)) '{print $l}')" LOOP=$((LOOP+1)) CURRENT_SSID="$(grep "^ssid=$ONLINE_SSID" $HOSTAPD | cut -d"=" -f2)" if [ "$CURRENT_SSID" = "$ONLINE_SSID" ]; then @@ -156,17 +156,17 @@ elif [ "$CHECK" -eq 0 ]; then echo "node is considered offline" if [ $UP -lt $FIRST ] || [ $M -eq 0 ]; then # set SSID offline, only if uptime is less than FIRST or exactly a multiplicative of switch_timeframe - if [ $UP -lt $FIRST ]; then + if [ $UP -lt $FIRST ]; then T=$FIRST else T=$MINUTES fi - #echo minute $M, check if $OFF_COUNT is more than half of $T + #echo minute $M, check if $OFF_COUNT is more than half of $T if [ $OFF_COUNT -ge $(($T / 2)) ]; then # node was offline more times than half of switch_timeframe (or than $FIRST) LOOP=1 for HOSTAPD in $(ls /var/run/hostapd-phy*); do - ONLINE_SSID="$(echo $ONLINE_SSIDs | awk -F '~' -v l=$((LOOP*2)) '{print $l}')" + ONLINE_SSID="$(echo $ONLINE_SSIDs | awk -F '~' -v l=$((LOOP*2)) '{print $l}')" LOOP=$((LOOP+1)) CURRENT_SSID="$(grep "^ssid=$OFFLINE_SSID" $HOSTAPD | cut -d"=" -f2)" if [ "$CURRENT_SSID" = "$OFFLINE_SSID" ]; then @@ -203,8 +203,8 @@ fi if [ $HUP_NEEDED = 1 ]; then # send HUP to all hostapd to load the new SSID killall -HUP hostapd - ## check for nonmachting hotapd-pidfiles - if [ -f /lib/gluon/eulenfunk-hotfix/check_hostapd.sh ] ; then + ## check for nonmachting hotapd-pidfiles + if [ -f /lib/gluon/eulenfunk-hotfix/check_hostapd.sh ] ; then sleep 2 # settle down ps|grep hostapd|grep .pid|xargs -n 10 /lib/gluon/eulenfunk-hotfix/check_hostapd.sh fi