时间:2021-07-01 10:21:17 帮助过:66人阅读
#!/bin/bash
file=/root/mysql.txt #mysql> show slave status\G;这个命令可以查看状态信息,保存到文件里面。
aa=($(cat $file | grep -E 'Running|Behind'| cut -d ':' -f2))
for ((i=0;i<${#aa[*]};i++))
do
count=0
if [ ${aa[i]} != "yes" -a ${aa[i]} != "0" ]; then
echo "bad"
let count+=1
else
echo "good"
fi
done关于30秒的延迟,将上面的这个脚本放到函数里面,在使用while true空值,并加上sleep 30
关于mysql主从是否正常的判断
标签:else mys 延迟 同步 while 复制 stat 主从 class