Created
October 15, 2012 21:27
-
-
Save opie4624/3895640 to your computer and use it in GitHub Desktop.
Based on http://serverfault.com/questions/47057/is-there-a-tool-to-log-internet-connectivity-on-a-mac
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
LOG=/tmp/netlog-$1 | |
rm -f $LOG | |
while ( true ); | |
do | |
ping -c1 -t 1 $1 > /dev/null | |
if [ "$?" -gt "0" ]; then | |
echo `date` " I am offline" | tee $LOG | |
traceroute -a $1 | tee $LOG | |
fi | |
sleep 5 ; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment