jablonka.czprosek.czf

netmap

Subversion Repositories:
[/] [gen_onestat_ping] - Rev 1 Go to most recent revision

Compare with Previous - Blame - Download


#!/bin/sh

# (c)2003 by Jan Krupa (krupaj@mobilnews.cz)
# http://www.mobilnews.cz/honza/

PING_PATH="ping -I 10.33.0.6"

for LINE in `cat $1`; do
  ping_host=`echo -n $LINE | awk -F\; '{ printf "%s", $2 }'`;

  ping_lat=\;`$PING_PATH -c 1 -w 2 $ping_host | grep rtt | awk -F\  '{ printf "%s", $4 }' | awk -F\/ ' { printf "%s", $2 }'`;
  if [ "$ping_lat" = ";" ]; then
    ping_lat=\;`$PING_PATH -c 1 -w 2 $ping_host | grep rtt | awk -F\  '{ printf "%s", $4 }' | awk -F\/ ' { printf "%s", $2 }'`;
  fi;
  
  if [ "$ping_lat" = ";" ]; then
    echo $ping_host\;0\;0\;;

  else
    echo $ping_host\;1$ping_lat\;;
  fi;
  
done

Powered by WebSVN 2.2.1