xshell 脚本网站域名监控-邮件提醒

  • Post author:
  • Post category:其他


#!/bin/sh

weblist=”/usr/test/weblist.txt”

myemail=”xxxxx@163.com”

for list in `cat $weblist|grep -E -v “#|^$”`

do

httpcode=`curl -o /dev/null -s -w %{http_code} “$list”`

httptime=`curl -o /dev/null -s -w “time_connect: %{time_connect}\ntime_starttransfer:%{time_starttransfer}\ntime_total: %{time_total}\n” “$list”|grep time_total|awk -F “:” ‘{print $2*1000}’`

if [ $httpcode = 200 ]||[ $httpcode = 301 ]||[ $httpcode = 302 ]

then echo “$list is-1 checked ok!-LianJieZhengChang”

else

echo “$list Warning-Error-FangWenShiBai-”

echo “$list is-down!-FangWenShiBai”| mutt -s “Warning: down” $myemail

fi

if [ $httptime -ge 5000 ]

then echo “$list is-3 timeout!-LianJieChaoShi” | mutt -s “Warning: t



版权声明:本文为understandAA原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。