Created
January 22, 2015 17:01
-
-
Save toddself/cb3d9d05f49ec58231c7 to your computer and use it in GitHub Desktop.
shitty wifi
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 | |
while true; do | |
trap "exit 0" SIGINT | |
CEIL=10 | |
timeout=0 | |
ip link show eth0 | grep UP > /dev/null | |
ISUP=$? | |
let "timeout = $RANDOM % $CEIL + 1" | |
if [ $ISUP -eq 0 ]; then | |
echo "eth0 is up, bringing down" | |
sudo ifconfig eth0 down | |
sleep $timeout | |
else | |
echo "eth0 is down, bringing up" | |
sudo ifconfig eth0 up | |
sleep $timeout | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment