linux shell获取show slave status方法
#!/bin/bash
array=($(mysql -u数据库账号 -p数据库密码 -e "show slave status/G"|grep "Running" |awk '{print $2}'))
if [ "${array[0]}" == "Yes" ] && [ "${array[1]}" == "Yes" ]
then
echo "slave is OK"
else
echo "slave is wrong"
fi
别忘记输入数据库账号和密码
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/aiops/1395.html