文章详情
时间: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
XLM币最具爆发力的安全交易所币安binance下载
XEM币最安全隐私链的全球交易所币安binance下载
WAVES币最新上线的优质交易所币安binance下载
1970-01-01