Skip to content

Instantly share code, notes, and snippets.

@sdomi
Created May 16, 2018 15:48
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 sdomi/f00927bfe768891867e213ea28fde888 to your computer and use it in GitHub Desktop.
Save sdomi/f00927bfe768891867e213ea28fde888 to your computer and use it in GitHub Desktop.
magic internet checker in bash
#!/bin/bash
# has interweb come back up? know today with this one simple trick!
ip=$1;
if ! [[ $ip ]]; then
ip="8.8.8.8";
fi
while true; do
if ping -c 1 $ip &> /dev/null; then
notify-send --urgency=critical --icon=firefox "Internet is back up!"
break
fi
sleep 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment