随机访问web

#!/bin/bash

ip_list=([0]="1.1.1.1" [1]="2.2.2.2" [2]="3.3.3.3")
i=0
while true
do
run_time=date +"%Y-%m-%d %H:%M:%S"
randnum=$(($RANDOM%3))
http_code=curl -m 5 -o /dev/null -s -w %{http_code} http://www.baidu.com/ -x ${ip_list[$randnum]}:80curl_status="$?"test "x${curl_status}" != "x0" && echo "==${curl_status}==${run_time}==${i}==" >> curl_errorn.log((i++))echo "==id:${i}==time:${run_time}==http_code:${http_code}" >> ./curl_website_count.logtest "x$i" == "x20" && echo "==${run_time}==end==${i}==" && exit 0done

相关文章
相关标签/搜索