Created
January 21, 2016 14:00
-
-
Save kitusmark/a1418c1bebe32919741a to your computer and use it in GitHub Desktop.
Checks for internet connection, prints the status on the terminal and save a status variable for later.
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 | |
#Checks for internet connection, prints the status on the terminal and save a status variable for later. | |
wget -q --tries=5 --timeout=20 --spider http://google.com | |
if [[ $? -eq 0 ]]; then | |
STATUS=true | |
echo "ONLINE | |
else | |
STATUS=false | |
echo "OFFLINE" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment