Skip to content

Instantly share code, notes, and snippets.

@alexkingorg alexkingorg/isp-uptime.sh
Last active Aug 29, 2015

Embed
What would you like to do?
Script to check the uptime of my ISP - I run this from a CRON job on a local box.
#!/bin/bash
# try 3 times - sometimes getting an initial DNS failure that clears up
COUNTER=0
while [ $COUNTER -lt 3 ]; do
ping -c 1 google.com &> /dev/null
if [ $? -ne 0 ]; then
echo "`date`: ping failed, isp is down!" >> /Users/aking/Dropbox/Temp/isp-ping-result.log
echo "`date`: ping failed, isp is down!" >> /Users/aking/Dropbox/Temp/isp-downtime.log
else
echo "`date`: ping succeeded." >> /Users/aking/Dropbox/Temp/isp-ping-result.log
let COUNTER=3
fi
let COUNTER=COUNTER+1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.