Skip to content

Instantly share code, notes, and snippets.

@passcod
Created September 7, 2013 09:47
Show Gist options
  • Select an option

  • Save passcod/6474275 to your computer and use it in GitHub Desktop.

Select an option

Save passcod/6474275 to your computer and use it in GitHub Desktop.
Script used to restart wifi whenever ping drops
#!/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