Advertisement
Guest User

Bash testhelper

a guest
Apr 14th, 2012
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.47 KB | None | 0 0
  1. # Bash testHalter for linux/haiku
  2. #
  3. # caka dobu (sekund), ak 10 za sebou pingov
  4. # su neposlanych, potom spusti halt.
  5. #
  6. # try 10 pings and when they are not sended,
  7. # then run halt
  8.  
  9. TIME=1
  10. i=0
  11. while [ 1 ]; do
  12.     ping 192.168.1.1 -c 1
  13.     if [ $? != 0 ]; then
  14.         echo "Ping was not sended"
  15.         let i=i+1
  16.         if [ $i = 10 ]; then
  17.             echo "goes shutdown"
  18.             break
  19.         fi
  20.     else
  21.         echo "Ping sended"
  22.         let i=0
  23.     fi
  24.     sleep $TIME;
  25. done
  26.  
  27. echo $i
  28.  
  29. echo "command: shutdown"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement