Un altre mega script que me penjo per aquí, aquest per fer-me pings a llistes d'IPs.
echo PINGING....
for ip in `cat ip_list | sed 's/[^0-9.:]/ /g' | sed 's/\ .*//g'`
do
port=`echo $ip | sed 's/^.*://g'`
ip=`echo $ip | sed 's/\:.*//g'`
died=`cat died_ip | grep $ip | wc -l`
if [ $died -eq 0 ]
then
rtt=`ping -an -c4 $ip | grep ^rtt | cut -d/ -f5,7 --output-delimiter=" "`
if [ "$rtt" == "" ]
then
rtt=died
echo $ip >> died_ip
fi
echo $ip:$port = $rtt
echo $ip:$port = $rtt >> pings
fi
done
echo REVERSED RANKING
cat pings | grep -v died | sort --key=3 -nr
exit 0
Cap comentari:
Publica un comentari a l'entrada
Escriu