Skip to content

Instantly share code, notes, and snippets.

@z4yx
Created September 6, 2020 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save z4yx/9596931d528d2ec4c99aaf2368ca5986 to your computer and use it in GitHub Desktop.
Save z4yx/9596931d528d2ec4c99aaf2368ca5986 to your computer and use it in GitHub Desktop.
#!/bin/bash
while true; do
fails=0
while ! ping -c1 $1 &>/dev/null;do
echo "Ping Fail $fails - `date`"
fails=$(($fails+1))
if [[ $fails > 3 ]]; then
echo "Restarting the Wi-Fi connection"
nmcli c down cqtest
nmcli c up cqtest
sleep 4
break
fi
done
sleep 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment