check web status

#!/bin/bashweb

sendmail() {bash

/usr/local/bin/sendEmail -f xyxsender@163.com -t test@relearn.com -s smtp.163.com -u "SERVER 192.168.31.$i" -xu xyxsender@163.com -xp "123456" -m "Alert: web 192.168.31.$i can't access"curl

}ide


while :url

dospa

    for i in {129,202,130}code

    doit

        status_code=`curl -I -o /dev/null -s -w "%{http_code}\n" http://192.168.31.$i`class

        if [ $status_code -ne 200 ]test

        then

            sendmail

            echo `date` >> /var/log/WebAlert.log

            echo "Alert Email has been sent" >> /var/log/WebAlert.log

            echo "---------------------------------------------"

        fi

    done

sleep 10

done

相關文章
相關標籤/搜索