Skip to content

Instantly share code, notes, and snippets.

@rustymyers
Created May 12, 2014 16:52
Show Gist options
  • Save rustymyers/f2b44e8a56d1792e49e2 to your computer and use it in GitHub Desktop.
Save rustymyers/f2b44e8a56d1792e49e2 to your computer and use it in GitHub Desktop.
Check for network
# Check for active connection
while [ "$NETACTIVE" == 'FALSE' ]; do
# If block to test internet availability
if ping -nc 3 8.8.8.8 | grep '100.0%' >/dev/null 2>&1;then
/bin/echo $(date) "failed to connect to server"
exit 1
else
/bin/echo $(date) "Success connecting to server"
# Do stuff here
NETACTIVE=TRUE
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment