Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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