[root@webmonitor shell]# cat phpmailmonitor.sh
#!/bin/sh
# FileName: phpmailmonitor.sh
# Date: 2010-11-02
# Author: chenhc
# Description: curl number and compare
# Version 1.0
# ep:./phpmailmonitor.sh
#####
contactphone="1345558021,12220550726"
code=`curl 'http://trader.gate.com/tools/pd/263smtpcheck/monitor.php'`
waiting=`echo $code|awk -F '1,' '{print $2}'|awk '{print $1}'`
sending=`echo $code|awk -F '2,' '{print $2}'|awk '{print $1}'`
fail=`echo $code|awk -F '4,' '{print $2}'|awk '{print $1}'`
lastfail=`cat /tmp/lastfail`
echo "waiting=$waiting"
echo "sending=$sending"
echo "fail=$fail"
check_null()
{
if [ -z "$1" ];then
wget --output-document=/dev/null "http://124.4.15.208/message.php?phone=$contactphone&msg=Lv.2 phpmailmonitor.sh exception`date +%k:%M`"
exit 1;
fi
}
check_null $code
check_null $waiting
check_null $fail
#if [ $waiting -gt 2000 ];then
# wget --output-document=/dev/null "http://124.4.15.208/message.php?phone=$contactphone&msg=Lv.2 $waiting mail is waiting sms from 200.6 phpmailmonitor.sh`date +%k:%M`"
#fi
echo "${lastfail}"
increasment=$((${fail}-${lastfail}))
echo $fail>/tmp/lastfail
if [ $increasment -gt 500 ];then
wget --output-document=/dev/null "http://124.4.15.208/message.php?phone=$contactphone&msg=Lv.2 $increasment mail fail sms from 200.6 phpmailmonitor.sh`date +%k:%M`"
fi
另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。