监控mysqlreport的shell脚本

来源:互联网 发布:underscore.js源码分析 编辑:程序博客网 时间:2024/05/23 05:07
#!/bin/bash
if [ "$1" == "" ]
then
 echo "Please input mysqld port number 21001-21007"


elif ([ "$1" != "21001" ] && [ "$1" != "21002" ] && [ "$1" != "21003" ]&& [ "$1" != "21004" ] && [ "$1" != "21005" ] && [ "$1" != "2
1006" ]  && [ "$1" != "21007" ])
then
 echo "Please input mysqld port number 21001-21007"


else
while(true)
 do
   ./mysqlreport --user=root --password=@123456 --socket=/usr/local/mysql/tmp/mysql-$1.sock >report.log
   sed '76,122d' report.log  //由于我使用的MyISAM引擎,在这里我过滤了所有的InnoDB信息
   rm -fr report.log
   sleep $2
   echo -e '\n'
   echo "##########################################################################################################################"
   echo -e  '\n' 
done


fi
~           
原创粉丝点击