WiFi_Check icon indicating copy to clipboard operation
WiFi_Check copied to clipboard

Issue with the script

Open donnib opened this issue 13 years ago • 2 comments

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

donnib avatar Oct 16 '12 12:10 donnib

Will check into this when I get a chance.

dweeber avatar Oct 25 '12 06:10 dweeber

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

pixout avatar Sep 10 '14 12:09 pixout