dig 统计域名加速

#!/bin/bash
#author   yeqing <492980936@qq.com>
#date     2015-07-19 10:26:28
yesNum=0
noNum=0
i=0
data=''
yesList=()
noList=()
date=`date +"%Y-%m-%d %H:%M"`
while read url; do
   dig ${url}|egrep 'cloudglb.net|hacdn.net|hadns.net' > /dev/null 2>&1
   if [ $? -eq 0 ]; then
       yesList[$i]=${url}
       yesNum=`expr ${yesNum} + 1`
      else
       noList[$i]=${url}
       noNum=`expr ${noNum} + 1`
   fi
   let i++
done < url.txt
for noUrl in ${noList[*]};do
   data="('${date}','${noUrl}',0,${yesNum},${noNum}),${data}"
done
for yesUrl in ${yesList[*]};do
  data="('${date}','${yesUrl}',1,${yesNum},${noNum}),${data}"
done

mysql -h 192.168.1.5 -uroot -p"123456" -s -e "insert into test.fastglb(time,domain,flag,yes,no) values${data%,*}";



本文转自cloves 51CTO博客,原文链接:http://blog.51cto.com/yeqing/1676070

上一篇:使用fastcgi_cache加速Nginx站点


下一篇:Heartbleed 漏洞补丁引发 SSL 链接 bug