Skip to content

Instantly share code, notes, and snippets.

@opie4624
Created October 15, 2012 21:27
Show Gist options
  • Select an option

  • Save opie4624/3895640 to your computer and use it in GitHub Desktop.

Select an option

Save opie4624/3895640 to your computer and use it in GitHub Desktop.

Revisions

  1. opie4624 revised this gist Oct 15, 2012. 1 changed file with 4 additions and 3 deletions.
    7 changes: 4 additions & 3 deletions netlog.sh
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,13 @@
    #!/bin/bash
    LOG=/tmp/netlog
    LOG=/tmp/netlog-$1
    rm -f $LOG
    while ( true );
    do
    ping -c1 -t 5 www.google.com > /dev/null
    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 60 ;
    sleep 5 ;
    done
  2. opie4624 revised this gist Oct 15, 2012. 1 changed file with 0 additions and 0 deletions.
    Empty file modified netlog.sh
    100644 → 100755
    Empty file.
  3. opie4624 created this gist Oct 15, 2012.
    12 changes: 12 additions & 0 deletions netlog.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    #!/bin/bash
    LOG=/tmp/netlog
    rm -f $LOG
    while ( true );
    do
    ping -c1 -t 5 www.google.com > /dev/null
    if [ "$?" -gt "0" ]; then
    echo `date` " I am offline" | tee $LOG
    fi

    sleep 60 ;
    done