linux shell获取show slave status方法
<pre>
#!/bin/bash
array=($(mysql -u数据库账号 -p数据库密码 -e "show slave statusG"|grep "Running" |awk '{print $2}'))
if [ "${array[0]}" == "Yes" ] && [ "${array[1]}" == "Yes" ]
then
echo "slave is OK"
else
echo "slave is wrong"
fi
</pre>
别忘记输入数据库账号和密码