Skip to content

Instantly share code, notes, and snippets.

@RayBB
Created April 7, 2018 23:06
Show Gist options
  • Save RayBB/18c12d73679f8c726c2c0a36bfd7db87 to your computer and use it in GitHub Desktop.
Save RayBB/18c12d73679f8c726c2c0a36bfd7db87 to your computer and use it in GitHub Desktop.
#!/bin/bash
echo "this must be run as sudo to work"
for (( ; ; ))
do
if ping -q -c 1 -W 1 208.67.222.222 >/dev/null; then
echo "IPv4 is up"
sleep 60
else
echo "IPv4 is down, restarting network service"
sudo service network-manager restart
sleep 60
fi
done
## This bash script should check for internet every 60 seconds and restart the service if it's not found
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment