通过脚本调用mysql来启动keepalived的配置的VIP

[root@mariadb01 ~]# cat check_mysql.sh 
MYSQL=/usr/bin/mysql 
MYSQL_HOST=localhost 
MYSQL_USER=root 
MYSQL_PASSWORD=123456

$MYSQL -h $MYSQL_HOST -u $MYSQL_USER -p$MYSQL_PASSWORD -e "show status;" >/dev/null 2>&1 
#$mysqlclient --host=$host --port=$port --user=$user --password=$password -e "show databases;" > /dev/null 2>&1 
if [ $? == 0 ] 
then 
echo " $host mysql login successfully " 
systemctl start keepalived
exit 0 
else 
echo " $host mysql login faild" 
systemctl stop keepalived 
exit 2 
fi



     本文转自wsw26 51CTO博客,原文链接:http://blog.51cto.com/wsw26/2067195,如需转载请自行联系原作者





上一篇:xammp start apache service FQA(xammp启动apache服务问题解决方案汇总)


下一篇:xamp方式安装bugfree,启动apache时报80或443端口占用