[root@localhost Desktop]# cat ab.sh
#!/bin/bash #author longxibendi #blog #function get the web servers information of companies' if [ -e /tmp/web_server.log ] ;then rm -f /tmp/web_server.log fi if [ -e /tmp/ab.log ] ; then rm -f /tmp/ab.log fi for company_name in taobao 360buy dangdang vancl mbaobao alibaba google baidu yahoo sina sohu renren changyou wanmei sdo 126 163 139 ifeng do { ab -n 1 -c 1 http://www.${company_name}.com/index.html | tee /tmp/ab_${company_name}.log 2>&1 if [ $? -eq 0 ] ; then printf "%15s, %20s\n" "${company_name}.com", " ` cat /tmp/ab_${company_name}.log | grep "Server Software" ` " >> /tmp/web_server.log fi sleep 2 }& done wait echo "It is OK "二.分析结果
[root@localhost Desktop]# cat /tmp/web_server.log taobao.com,, Server Software: nginx mbaobao.com,, Server Software: renren.com,, Server Software: nginx/0.7.67 google.com,, Server Software: gws yahoo.com,, Server Software: YTS/1.20.0 sina.com,, Server Software: Apache/2.0.63 changyou.com,, Server Software: Apache sdo.com,, Server Software: SVS alibaba.com,, Server Software: Apache/2.2.15 ifeng.com,, Server Software: nginx/0.8.32 126.com,, Server Software: Apache sohu.com,, Server Software: SWS dangdang.com,, Server Software: nginx/0.6.37 vancl.com,, Server Software: Microsoft-IIS/6.0 163.com,, Server Software: nginx wanmei.com,, Server Software: nginx 360buy.com,, Server Software: jdws baidu.com,, Server Software: BWS/1.0 139.com,, Server Software: Apache可以简单猜测到Google 和 Baidu使用的自己的 web server ,当然taobao 对Nginx进行了二次开发。这个章文嵩博士讲过。
三.进一步分析结果
[root@localhost Desktop]# cat /tmp/web_server.log | awk ' {print $4;}' | grep -v "^$"
nginx
nginx/0.7.67
gws
YTS/1.20.0
Apache/2.0.63
Apache
SVS
Apache/2.2.15
nginx/0.8.32
Apache
SWS
nginx/0.6.37
Microsoft-IIS/6.0
nginx
nginx
jdws
BWS/1.0
Apache
四.更进一步统计一下