008.MySQL-Keepalived搭配脚本02
1 vim /etc/keepalived/check_MySQL.sh 2 #!/bin/sh 3 #isok=$(sed -n '2p' /etc/keepalived/result.txt) 4 isok=$(/usr/local/mysql/bin/mysql -uroot -p123456 -e 'select 1' |sed -n '2p') 5 function error_query(){ 6 service keepalived stop 7 echo "172.16.16.34 mysql down, keepalived 切换" | mail -s "34MySQL+keepalived通知" ma.xiangqian@sf-express.com 8 } 9 echo "$isok" 10 if [ "$isok" != "1" ] 11 then 12 #echo 'diaoyong error' 13 error_query 14 fi
作者:木二
出处:http://www.cnblogs.com/itzgr/
关于作者:云计算、虚拟化,Linux,多多交流!
本文版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文链接!如有其他问题,可邮件(xhy@itzgr.com)咨询。