Skip to content
Snippets Groups Projects
Commit 1c0bd14e authored by MrMM's avatar MrMM
Browse files

Only change SSID if the exakt offline or onlie ssid is found

parent 51d7a969
No related branches found
No related tags found
No related merge requests found
...@@ -21,31 +21,41 @@ if [ $GATEWAY_TQ -gt 50 ]; ...@@ -21,31 +21,41 @@ if [ $GATEWAY_TQ -gt 50 ];
then then
echo "Gateway TQ is $GATEWAY_TQ node is online" echo "Gateway TQ is $GATEWAY_TQ node is online"
for HOSTAPD in $(ls /var/run/hostapd-phy*); do for HOSTAPD in $(ls /var/run/hostapd-phy*); do
CURRENT_SSID=`grep '^ssid=' $HOSTAPD | cut -d"=" -f2` CURRENT_SSID=`grep "^ssid=$ONLINE_SSID" $HOSTAPD | cut -d"=" -f2`
if [ $CURRENT_SSID == $ONLINE_SSID ] if [ $CURRENT_SSID == $ONLINE_SSID ]
then then
echo "SSID $CURRENT_SSID is correct, noting to do" echo "SSID $CURRENT_SSID is correct, noting to do"
HUP_NEEDED=0 HUP_NEEDED=0
else fi
CURRENT_SSID=`grep "^ssid=$OFFLINE_SSID" $HOSTAPD | cut -d"=" -f2`
if [ $CURRENT_SSID == $OFFLINE_SSID ]
then
echo "SSID is $CURRENT_SSID, change to $ONLINE_SSID" echo "SSID is $CURRENT_SSID, change to $ONLINE_SSID"
sed -i s/^ssid=.*/ssid=$ONLINE_SSID/ $HOSTAPD sed -i s/^ssid=$CURRENT_SSID/ssid=$ONLINE_SSID/ $HOSTAPD
HUP_NEEDED=1 # HUP here would be to early for dualband devices HUP_NEEDED=1 # HUP here would be to early for dualband devices
else
echo "There is something wrong, did not find SSID $ONLINE_SSID or $OFFLINE_SSID"
fi fi
done done
else else
echo "Gateway TQ is $GATEWAY_TQ node is considered offline" echo "Gateway TQ is $GATEWAY_TQ node is considered offline"
for HOSTAPD in $(ls /var/run/hostapd-phy*); do for HOSTAPD in $(ls /var/run/hostapd-phy*); do
CURRENT_SSID=`grep '^ssid=' $HOSTAPD | cut -d"=" -f2` CURRENT_SSID=`grep "^ssid=$OFFLINE_SSID" $HOSTAPD | cut -d"=" -f2`
if [ $CURRENT_SSID == $OFFLINE_SSID ] if [ $CURRENT_SSID == $OFFLINE_SSID ]
then then
echo "SSID $CURRENT_SSID is correct, noting to do" echo "SSID $CURRENT_SSID is correct, noting to do"
HUP_NEEDED=0 HUP_NEEDED=0
else fi
echo "SSID is $CURRENT_SSID, change to $OFFLINE_SSID" CURRENT_SSID=`grep "^ssid=$ONLINE_SSID" $HOSTAPD | cut -d"=" -f2`
sed -i "s/^ssid=.*/ssid=$OFFLINE_SSID/" $HOSTAPD if [ $CURRENT_SSID == $ONLINE_SSID ]
HUP_NEEDED=1 # HUP here would be to early for dualband devices then
fi echo "SSID is $CURRENT_SSID, change to $OFFLINE_SSID"
sed -i s/^ssid=$ONLINE_SSID/ssid=$OFFLINE_SSID/ $HOSTAPD
HUP_NEEDED=1 # HUP here would be to early for dualband devices
else
echo "There is something wrong, did not find SSID $ONLINE_SSID or $OFFLINE_SSID"
fi
done done
fi fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment