心想事成
sinxadmin
全部博文(75)
Python(1)
Java(0)
Perl(6)
Shell(5)
Oracle(32)
Mysql(8)
Solaris(0)
HP(0)
AIX(0)
Linux(16)
2011年(1)
2010年(9)
2009年(65)
cynthia
浪花小雨
hongwent
damoluom
s2t61
分类:
2009-04-30 17:12:04
#!/bin/bash#configurationslave_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 Emailsend_mail(){ mail -s "Slave status" root@localhost.localdomain << EOF $io_status $sql_status $Behind_Master_StatusEOF}#get slave statusresult=$($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_mailfi
上一篇:mysql二进制日志备份
下一篇:英语笔记
登录 注册