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 ];
then
echo "Gateway TQ is $GATEWAY_TQ node is online"
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 ]
then
echo "SSID $CURRENT_SSID is correct, noting to do"
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"
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
else
echo "There is something wrong, did not find SSID $ONLINE_SSID or $OFFLINE_SSID"
fi
done
else
echo "Gateway TQ is $GATEWAY_TQ node is considered offline"
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 ]
then
echo "SSID $CURRENT_SSID is correct, noting to do"
HUP_NEEDED=0
else
echo "SSID is $CURRENT_SSID, change to $OFFLINE_SSID"
sed -i "s/^ssid=.*/ssid=$OFFLINE_SSID/" $HOSTAPD
HUP_NEEDED=1 # HUP here would be to early for dualband devices
fi
fi
CURRENT_SSID=`grep "^ssid=$ONLINE_SSID" $HOSTAPD | cut -d"=" -f2`
if [ $CURRENT_SSID == $ONLINE_SSID ]
then
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
fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment