-
-
Save gairys/d5f40d7a311b1f45a76a5236fe32da51 to your computer and use it in GitHub Desktop.
Reset wlan0 nttwork interface on Raspberry Pi
This file contains hidden or 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 | |
| ping -W 2 -c 1 8.8.8.8 > /dev/null | |
| if [ $? -eq 0 ]; then | |
| echo "online" | |
| else | |
| echo "offline" | |
| logger -t [warn] “Internet connection lost. Trying to reload network interface” | |
| sudo ifdown wlan0 | |
| sleep 3 | |
| sudo ifup wlan0 | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment