网站访问用时统计

#!/bin/bash
domain="$1"
i=0
j=0
echo 'total,    nstim,    conne,    appco,    pretr,    redir,    statt'
while [ 1 ]
do
((j++))
mess=`curl -s -o /dev/null 2>/dev/null --write-out "%{time_total},    %{time_namelookup},    %{time_connect},    %{time_appconnect},    %{time_pretransfer},    %{time_redirect},    %{time_starttransfer}" $domain`
time_total=`echo $mess |awk -F ',' '{print $1}'`
check1=`awk -v num1="$time_total" -v num2=1 'BEGIN{print(num1>num2)?"0":"1"}'`
if [ "$check1" -eq "0" ];then
#    echo "$mess" >> /tmp/${domain}.log 2>/dev/null
   echo "$mess" `date` $i/$j
   ((i++))
       if [ "$i" -ge "1000" ];then
           exit 0
       fi
fi
done


你可能感兴趣的:(网站访问用时统计)