监控数据库脚本五

[root@db01-51 scripts]# cat check_db.sh 
#!/bin/bash
#remote
if [ "`nmap 10.0.0.51 -p 3306 2>/dev/null |grep open|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:39  reborn枪  阅读(67)  评论(0)    收藏  举报