Created
September 8, 2015 15:05
-
-
Save marianmoldovan/c2bc8bc3bd366ffad127 to your computer and use it in GitHub Desktop.
Wifi check script raspberry pi rpi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# The IP for the server you wish to ping (8.8.8.8 is a public Google DNS server) | |
SERVER=8.8.8.8 | |
# Only send two pings, sending output to /dev/null | |
ping -c2 ${SERVER} > /dev/null | |
# If the return code from ping ($?) is not 0 (meaning there was an error) | |
if [ $? != 0 ] | |
then | |
# Restart the wireless interface | |
ifdown --force wlan0 | |
ifup wlan0 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment