Created
September 7, 2013 09:47
-
-
Save passcod/6474275 to your computer and use it in GitHub Desktop.
Script used to restart wifi whenever ping drops
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
| #!/usr/bin/bash | |
| if [[ $(id -u) != 0 ]]; then | |
| sudo $0 | |
| exit | |
| fi | |
| nlc=0 | |
| itv=2 | |
| while true; do | |
| sleep $itv | |
| let nlc+=$itv | |
| if [[ $nlc -ge 60 ]]; then | |
| nlc=0 | |
| echo | |
| fi | |
| if ping -c1 -w5 -W5 -s996 8.8.8.8 >/dev/null; then | |
| echo -n . | |
| else | |
| echo -en "\007" | |
| echo -n x | |
| netctl stop auckland-base | |
| ip link set wlp2s0 down | |
| netctl start auckland-base | |
| fi | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment