温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

tomcat状态监测脚本

发布时间:2020-07-21 02:42:59 来源:网络 阅读:302 作者:mailfile 栏目:系统运维

tar zxvf heirloom-mailx_12.5.orig.tar.gz 

cd heirloom-mailx-12.5/

make && make install UCBINSTALL=/usr/bin/install

cp /etc/nail.rc /etc/nail.rc.bak

vim /etc/nail.rc


set from=xxx@126.com   发送邮箱

set smtp=smtp.126.com  发送邮箱smtp地址

set smtp-auth-user=xxx@126.com 接收邮箱

set smtp-auth-password=xxx    邮箱密码

set smtp-auth=login                                                          

echo 123 | mailx -v -s "zabbix test mail" xxx@126.com

com

-bash: echp: command not found

Resolving host smtp.126.com . . . done.

Connecting to 220.181.15.111:25 . . . connected.

220 126.com Anti-spam GT for Coremail System (126com[20140526])

>>> EHLO vm172-18-0-18.ksc.com

250-mail

250-PIPELINING

250-AUTH LOGIN PLAIN 

250-AUTH=LOGIN PLAIN

250-coremail 1Uxr2xKj7kG0xkI17xGrU7I0s8FY2U3Uj8Cz28x1UUUUU7Ic2I0Y2UFhQBZHUCa0xDrUUUUj

250-STARTTLS

250 8BITMIME

>>> AUTH LOGIN

334 dXNlcm5hbWU6

>>> d3loMTk4NzI1QDEyNi5jb20=

334 UGFzc3dvcmQ6

>>> V1lIMTk4NzI1IUAj

235 Authentication successful

>>> MAIL FROM:<wyh298725@126.com>

250 Mail OK

>>> RCPT TO:<wyh298725@126.com>

250 Mail OK

>>> DATA

354 End data with <CR><LF>.<CR><LF>

>>> .

250 Mail OK queued as smtp1,C8mowABnDOoAivZZ4IC0AQ--.8734S2 1509329409

>>> QUIT

221 Bye


tomcat状态监测脚本


touch /root/health_crm.sh

touch /tmp/health_crm/health_crm.log

vim /root/health_crm.sh

#!/bin/bash


set i=10

while true

do

   let "i=i+10"

   response=`curl  --silent http://xx.com/  -i|egrep "HTTP/1.1" |awk -F ' '  '{print $2}'`

   code=`curl  --silent http://xxx.com/ >> /tmp/health_tomcat/health_crm.log`

   if [ $response != 200 ]

    then

     

       echo "$response" |mail -s "your website is not ok now!"  xx@xx.com

   else

      curl  --silent http://xx.com/ >> /tmp/health_crm/health_crm.log

     sleep 300

   fi

done

   

#done


crontab -e 

5 * * * *  root  /bin/sh  /root/health_crm.sh

service crond restart && service ntpd restart

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI