ping_alive 283 Bytes
Newer Older
Nico Schottelius's avatar
Nico Schottelius committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#!/bin/sh

HOST="192.168.0.1"

ret="true"
sleep="2"
count="2"

if [ -n "$1" ]; then HOST=$1;fi 

while true; do
	ping -c$count $HOST  >/dev/null 2>/dev/null || ret=failed
	if [ $ret = "failed" ];  then
		echo "Failed: "`date`
	else
		echo "Recieved: "`date`
	fi
	sleep $sleep 
done