Issue with the script
Hi, I like your script (the idea behind it) but it doesn't work for me. As far as i understand you are looking to see if there is an ip address to decide whether you need to restart the wlan but in my case the Pi does not drop the ip address after the router has rebooted so when the router is offline the ip address is still there so the script won't restart wlan. Have you seen this issue ?
/Mihai
Will check into this when I get a chance.
Yes, I have fixed this problem, you need to change code:
echo "Performing Network check for $wlan" if ifconfig $wlan | grep -q "inet addr:" ; then echo "Network is Okay" else echo "Network connection down! Attempting reconnection." ifdown $wlan sleep 5 ifup --force $wlan ifconfig $wlan | grep "inet addr" fi
to this:
echo "Performing Network check for $wlan" if iwconfig $wlan | grep -qo 'unassociated'; then echo "Network connection down! Attempting reconnection." ifdown $wlan # it could be up even after ifdown, so kill wpa_supplicant killall wpa_supplicant sleep 5 ifup $wlan ifconfig $wlan | grep "inet addr" fi