监控数据库脚本二

[root@db01-51 scripts]# cat check_db.sh 
#!/bin/bash
#local
if [ "`ps -ef |grep mysql|grep -v grep|wc -l`" -gt 0 ]
  then
    echo "MySQL is running"
  else
    echo "MySQL is stoped"
    /etc/init.d/mysqld start
fi

  

posted @ 2017-03-09 22:19  reborn枪  阅读(55)  评论(0)    收藏  举报