Think before you speak, read before you think.

多节点梯子择优脚本

by

in
[jpuyy@jpuyy-laptop allconf]$ cat tizi.sh 
#/bin/bash

suffix='.heredance.com'

locations='jp1 jp2 jp3 us1 us2 us3 us4 us5 sg1 sg2 hk1 hk2 tw1 uk1'

result_file='/tmp/.result_array'

> $result_file
for location in $locations;
do
    result=`ping -q -A -c 10 $location$suffix | grep received`
    echo "$location$suffix $result" >> $result_file
done

cat $result_file | sort -r -n -k 5 -k 11

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *