文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>check_slave

check_slave

时间:2009-04-30  来源:sinxadmin

#!/bin/bash

#configuration

slave_host='localhost'
slave_port='3306'
slave_user='root'
slave_password='123456'
my_command='/usr/bin/mysql'
io_ok="Slave_IO_Running: Yes"
sql_ok="Slave_SQL_Running: Yes"
Behind_Master_NULL="Seconds_Behind_Master: NULL"
###############################


##function


#sebd Email

send_mail(){
        mail -s "Slave status" [email protected] << EOF
        $io_status
        $sql_status
        $Behind_Master_Status
EOF

}

#get slave status

result=$($my_command -h"$slave_host" -P"$slave_port" -u"$slave_user" -p"$slave_password" -e 'show slave status\G')
io_status=$(echo "$result" | grep "Slave_IO_Running:")
sql_status=$(echo "$result"|grep "Slave_SQL_Running:")
Behind_Master_Status=$(echo "$result" | grep "Seconds_Behind_Master")

if [[ $io_ok || $sql_ok || $Behind_Master_Status=$Behind_Master_NULL ]]
then
        send_mail
fi

相关阅读 更多 +
排行榜 更多 +
街头冲突帮派战斗

街头冲突帮派战斗

动作格斗 下载
componut

componut

休闲益智 下载
搜狗浏览器12.1版

搜狗浏览器12.1版

游戏工具 下载