Chinaunix首页 | 论坛 | 博客
  • 博客访问: 111829
  • 博文数量: 25
  • 博客积分: 1094
  • 博客等级: 少尉
  • 技术积分: 284
  • 用 户 组: 普通用户
  • 注册时间: 2009-05-25 16:36
文章分类

全部博文(25)

文章存档

2011年(14)

2010年(11)

分类: LINUX

2010-03-09 16:13:59

 

socket=/var/lib/mysql/mysql.sock
user=root
for i in $socket
    do
    mysql=$(mysql -u $user  --socket=$i -e "show slave status\G" | \
                awk 'BEGIN {
                                tel = 0
                        }
                        /Slave_IO_Running: Yes/  { tel++ }
                        /Slave_SQL_Running: Yes/ { tel++ }
                        END {
                                if ( tel == 2 ) {
                                        print "Yes"
                                } else {
                                        print "No"
                                }
                        }'
    )
                                if [ $mysql = Yes ]; then
                                echo "mysql主从正常"
                                else
                                echo "mysql主从出现故障"
                                fi
done

阅读(1296) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~