返回顶部

收藏

shell脚本监控mysql,需要时重启

更多

shell脚本监控mysql,需要时重启

#!/bin/bash
MUSER=”root”
MPASS=”123456″
MRESET=”/etc/rc.d/init.d/mysql restart”
MADMIN=”/usr/local/mysql/bin/mysqladmin”
while true
 do
$MADMIN -u$MUSER -p$MPASS ping 2>/dev/null 1>/dev/null
if [ $? -ne 0 ];then
     msg=”server is not respinse waring:127.0.0.1″
     echo $msf >>/var/log/mysql.log
     $MRESET >/dev/null
   else
      echo “mysql operating normally” >>/var/log/mysql.log
  fi
  sleep 60
 done

标签:shell,监控,mysql

收藏

0人收藏

支持

0

反对

0

发表评论