标签:
[root@localhost wyb]# cat jkmysql #!/bin/bash status=`/etc/init.d/mysqld status|grep running|wc -l` process=`ps -ef |grep mysqld|grep -v grep|wc -l` port=`lsof -i:3306|grep -i listen|wc -l` mysql -uroot -p‘test‘ -e "show databases;" >/dev/null 2>/dev/null a=$? [ $a -eq 0 ] && [ $port -ne 0 ] && [ $process -ne 0 ] && [ $status -ne 0 ] echo "mysql is running" || echo "mysql is not running" [root@localhost wyb]# bash jkmysql mysql is running [root@localhost wyb]#
标签:
原文地址:http://www.cnblogs.com/wangyuebo/p/5870320.html