标签:健康检查
#!/bin/sh
#date:2015-12-07
#filename:check_mysql.sh
#作者:linuxzkq
#Email:1729294227@qq.com
#version:v1.0
#port=`netstat -tunlp|grep 3306|wc -l`
#process=`ps -ef|grep mysqld|grep -v grep|wc -l`
value=`/application/mysql/bin/mysql -u root -poldboy -e "select version();" >/dev/null 2>&1`
while true
do
if [ $? -ne 0 ]
then
#echo "ERROR! MySQL is not running"
/etc/init.d/mysqld start
else
echo "MySQL is running,now!"
fi
sleep 5
value=`/application/mysql/bin/mysql -u root -poldboy -e "select version();" >/dev/null 2>&1`
if [ $? -ne 0 ]
then
#echo "ERROR! MySQL is not running"
/etc/init.d/mysqld start
else
echo "MySQL is running,now!"
fi
sleep 5
done
本文出自 “兰州linux运维” 博客,请务必保留此出处http://linuxzkq.blog.51cto.com/9379412/1728877
标签:健康检查
原文地址:http://linuxzkq.blog.51cto.com/9379412/1728877