
Bash testhelper
By: a guest on
Apr 14th, 2012 | syntax:
Bash | size: 0.47 KB | hits: 76 | expires: Never
# Bash testHalter for linux/haiku
#
# caka dobu (sekund), ak 10 za sebou pingov
# su neposlanych, potom spusti halt.
#
# try 10 pings and when they are not sended,
# then run halt
TIME=1
i=0
while [ 1 ]; do
ping 192.168.1.1 -c 1
if [ $? != 0 ]; then
echo "Ping was not sended"
let i=i+1
if [ $i = 10 ]; then
echo "goes shutdown"
break
fi
else
echo "Ping sended"
let i=0
fi
sleep $TIME;
done
echo $i
echo "command: shutdown"