Skip to content

Instantly share code, notes, and snippets.

@cganterh
Created June 16, 2014 20:24
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save cganterh/ffc2fffa8263857cbece to your computer and use it in GitHub Desktop.
Save cganterh/ffc2fffa8263857cbece to your computer and use it in GitHub Desktop.
Simple bash script to test the internet connection state.
#!/bin/bash
while true
do
wget -q --tries=10 --timeout=20 -O - http://google.com > /dev/null
if [[ $? -eq 0 ]]; then
echo $(date) "1" | tee -a log.csv
else
echo $(date) "0" | tee -a log.csv
fi
sleep 5
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment