Skip to content

Instantly share code, notes, and snippets.

@ataliba
Created September 22, 2012 00:43
Show Gist options
  • Save ataliba/3764693 to your computer and use it in GitHub Desktop.
Save ataliba/3764693 to your computer and use it in GitHub Desktop.
Checking Internet Connection with wget
#!/bin/bash
HOST=$1
WGET="/usr/bin/wget"
$WGET -q --tries=10 --timeout=5 $HOST
RESULT=$?
if [[ $RESULT -eq 0 ]]; then
echo "Connection made successfully to $HOST"
else
echo "Fail to make connection to $HOST"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment