测试节点对客户站点缓存状态的脚本
客户用到的节点ip放在文件ip.txt里,例如
192.168.1.1 192.168.1.2 192.168.1.3 192.168.1.4 192.168.1.5 192.168.1.6 192.168.1.7 192.168.1.8 192.168.1.9 192.168.1.10
check_proxy.sh
1 if [ $# -ne 1 ];then 2 echo usage: ./check_proxy.sh site 3 echo example: ./check_proxy.sh www.test.com 4 exit 5 fi 6 for ip in $(cat ip.txt) 7 do 8 #curl --silent -m 3 -I -x $ip:80 $1 | grep "200 OK" &> /dev/null 9 curl --silent -m 3 -I -x $ip:80 $1 | grep -q "200 OK" 10 if [ $? -eq 0 ];then 11 echo -e "\e[1;32m$ip\t\tOK\e[0m" 12 else 13 echo -e "\e[1;31m$ip\t\tFail\e[0m" 14 fi 15 done