Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with the script #1

Open
donnib opened this issue Oct 16, 2012 · 2 comments
Open

Issue with the script #1

donnib opened this issue Oct 16, 2012 · 2 comments

Comments

@donnib
Copy link

donnib commented Oct 16, 2012

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

@dweeber
Copy link
Owner

dweeber commented Oct 25, 2012

Will check into this when I get a chance.

@pixout
Copy link

pixout commented Sep 10, 2014

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants