tar zxvf heirloom-mailx_12.5.orig.tar.gz
成都创新互联成立于2013年,是专业互联网技术服务公司,拥有项目网站设计制作、成都网站制作网站策划,项目实施与项目整合能力。我们以让每一个梦想脱颖而出为使命,1280元望城做网站,已为上家服务,为望城各地企业和个人服务,联系电话:18982081108
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:
250 Mail OK
>>> RCPT TO:
250 Mail OK
>>> DATA
354 End data with
>>> .
250 Mail OK queued as smtp1,C8mowABnDOoAivZZ4IC0AQ--.8734S2 1509329409
>>> QUIT
221 Bye
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
当前标题:tomcat状态监测脚本
转载注明:http://scgulin.cn/article/pioeid.html