1 | 1 | simandl | #!/bin/sh |
2 | | | |
3 | | | # (c)2003 by Jan Krupa (krupaj@mobilnews.cz) |
4 | | | # http://www.mobilnews.cz/honza/ |
5 | | | |
6 | 27 | simandl | PING_PATH="ping -I 10.33.12.4" |
7 | 1 | simandl | |
8 | | | for LINE in `cat $1`; do |
9 | | | ping_host=`echo -n $LINE | awk -F\; '{ printf "%s", $2 }'`; |
10 | | | |
11 | | | ping_lat=\;`$PING_PATH -c 1 -w 2 $ping_host | grep rtt | awk -F\ '{ printf "%s", $4 }' | awk -F\/ ' { printf "%s", $2 }'`; |
12 | | | if [ "$ping_lat" = ";" ]; then |
13 | | | ping_lat=\;`$PING_PATH -c 1 -w 2 $ping_host | grep rtt | awk -F\ '{ printf "%s", $4 }' | awk -F\/ ' { printf "%s", $2 }'`; |
14 | | | fi; |
15 | | | |
16 | | | if [ "$ping_lat" = ";" ]; then |
17 | | | echo $ping_host\;0\;0\;; |
18 | | | |
19 | | | else |
20 | | | echo $ping_host\;1$ping_lat\;; |
21 | | | fi; |
22 | | | |
23 | | | done |