Quicker and simpler wifi check

So I needed a way on bootup to see if I was connected to the home wifi or not.

 

Figured when i’m away from home I wont be able to “see” the home network so why not just test to see if its in range on bootup, and if its not assume we’re out enjoying the great outdoors and disable the home network. ┬áThis means I can have the router enable the Access Point rather than work as a bridge when i’m home

Create a new file: nano /usb/sbin/wificheck.sh

put this in the file

uci set wireless.@wifi-iface[0].disabled=0
uci commit wireless
wifi

sleep 5
if iw dev wlan0 scan| grep -qi NETWORKNAMEHERE; then
logger “Home network found (NETWORKNAME), leaving network online”
else
logger “Away from Home – Disabling home wifi”
uci set wireless.@wifi-iface[0].disabled=1
uci commit wireless;
wifi
fi

save the file

then run chmod +x /usb/sbin/wificheck.sh

nano /etc/rc.local

add the line

/usr/sbin/wificheck.sh

save the file

reboot