#!/bin/bash
values=`curl -H 'Cache-Control: no-cache' -k -s -m 10 --connect-timeout 10 "$1" |grep "$2"|wc -l`
sleep 3
values1=`curl -H 'Cache-Control: no-cache' -k -s -m 10 --connect-timeout 10 "$1" |grep "$2"|wc -l`
echo "=============================================================" >> /tmp/web.txt
echo `date` >> /tmp/web.txt
echo $1 >> /tmp/web.txt
echo $2 >> /tmp/web.txt
echo "=============================================================" >> /tmp/web.txt
echo "=============================================================" >> /tmp/web.txt
echo `date +'%Y-%m-%d %H:%M:%S'` >> /tmp/web.txt
curl -H 'Cache-Control: no-cache' -k -s "$1" -m 10 --connect-timeout 10 >> /tmp/web.txt
if (($values < 1)) && (($values1 < 1));then
echo 0
echo '------------------------error---------------------------------' >> /tmp/web.txt
curl -H 'Cache-Control: no-cache' -I -k -s "$1" -m 10 --connect-timeout 10 >> /tmp/web.txt
else
echo 1
fi
#脚本很简单但是演变过程却是是一把辛酸泪。