#!/bin/bash
user=***
password=***
echo -e "please inpute slave portarl ip:"
read host
cd `dirname $0`
mysql -u$user -p$password -h$host -e "show slave status\G;" | grep -i running >slave.log
#grep -i, --ignore-case
# 忽略大小写,包含要搜寻的样式及被搜寻的档案。
if [ `cat slave.log | grep -i io | awk '{print $2}'` = Yes ]
then
echo "slave IO process is OK"
else
echo "slave IO process is error"
fi
if [ `cat slave.log | grep -i sql | awk '{print $2}'` = Yes ]
then
echo "slave SQL process is OK"
else
echo "slave SQL process is error"
fi
rm -rf slave_status
阅读(822) | 评论(1) | 转发(0) |