X-Git-Url: https://src.twobees.de/?a=blobdiff_plain;f=stow%2Fbin%2F.bin%2Fnetcheck.sh;fp=stow%2Fbin%2F.bin%2Fnetcheck.sh;h=fc0b773af4b651596cce564d78a0c727340ab47d;hb=ff85db6abf778cd90b7bf4bec7edde1f8924ec58;hp=0000000000000000000000000000000000000000;hpb=d0228fb089c4d0dd83e14f10bc3198232eb93217;p=dotfiles.git diff --git a/stow/bin/.bin/netcheck.sh b/stow/bin/.bin/netcheck.sh new file mode 100755 index 0000000..fc0b773 --- /dev/null +++ b/stow/bin/.bin/netcheck.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +upOrDown=3 # 1 = down, 2 up , 3 unknown +host="1.1.1.1" + +SLEEP_SECS=1 +while true +do + + if ping -w 2 -c 1 "$host" > /dev/null 2>&1; + then + if [ $upOrDown -ne 2 ];then + upOrDown=2 + echo "$(date) $host ok" + fi + else + if [ $upOrDown -ne 1 ];then + upOrDown=1 + echo "$(date) $host NOT OK" + fi + fi + sleep $SLEEP_SECS +done