Chinaunix首页 | 论坛 | 博客
  • 博客访问: 15460
  • 博文数量: 1
  • 博客积分: 15
  • 博客等级: 民兵
  • 技术积分: 22
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-13 09:25
文章分类

全部博文(1)

文章存档

2014年(1)

我的朋友
最近访客

分类: LINUX

2014-08-15 19:43:53

#!/bin/bash
user=root
passwd=123qwe
cat /dev/null > r1.txt
cat /dev/null > r2.txt
if [[ "$1" = "--help" ]];then
        echo "variables:mysql variables;null:all variables;"
exit 1
elif [[ "$1" != "" ]];then
        echo $1 $2 $3 > temp.txt
        var=`awk -F"[ :]+" '{print $5}' temp.txt`
        h1=`awk -F"[ :]+"  '{print $1}' temp.txt`
        p1=`awk -F"[ :]+"  '{print $2}' temp.txt`
        h2=`awk -F"[ :]+"  '{print $3}' temp.txt`
        p2=`awk -F"[ :]+"  '{print $4}' temp.txt`


echo $h1 $p1 $h2 $p2


        result1=`mysql -u${root} -p${passwd}  -h${h1} -P${p1} -e "select * from information_schema.global_variables;" | grep -i $var | awk '{print $2}'`
        result2=`mysql -u${root} -p${passwd}  -h${h2} -P${p2} -e "select * from information_schema.global_variables;" | grep -i $var | awk '{print $2}'`
        echo $var : $result1 > r1.txt
        echo $var : $result2 > r2.txt
        diff r1.txt r2.txt -y -W 150


elif [ "$1" = "" ];then
        `mysql -u${root} -p${passwd}  -hlocalhost -P3306 -e "select * from information_schema.global_variablesG" > r1.txt`
        `mysql -u${root} -p${passwd}  -hlocalhost -P3306 -e "select * from information_schema.global_variablesG" > r2.txt`
        #echo $result1 > r1.txt
        #echo $result2 > r2.txt
        diff r1.txt r2.txt -y -W 150


echo "if different#############################"


        diff r1.txt r2.txt
else
        echo error
fi

脚本弱 写的简单~~



阅读(1577) | 评论(0) | 转发(0) |
0

上一篇:没有了

下一篇:没有了

给主人留下些什么吧!~~