多节点梯子择优脚本

[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

发表评论

电子邮件地址不会被公开。 必填项已用*标注

This site uses Akismet to reduce spam. Learn how your comment data is processed.