检测MYSQL不同步发邮件通知的脚本

脚本代码如下:
#!/bin/bash                                                                                                                # Info   : check mysql slave                                                                                               # Author : dingtm                                                                                                          # CTime  : 2011.03.21                                                                                                      # This script run by root                                                                                                                                                                                                                             DBDir=/elain/apps/mysql/bin/                                                                                               DBSock=/elain/data/mysql/3306/mysql.sock                                                                                   Log=/tmp/mysql_slave.log                                                                                                   DBUser=root                                                                                                                DBPasswd=elain                                                                                                        [email protected],[email protected]                                                                                                                                                                                                           Seconds_Behind_Master=$(${DBDir}mysql -u${DBUser} -p${DBPasswd} -S ${DBSock} -e "show slave status\G;" | awk -F':' '/Seconds_Behind_Master/{print $2}')                                                                                              
本文来自: 华盟黑客(中国最大黑客培训中心网站) 详细出处参考:http://www.hmhack.com/article/html/283.html

你可能感兴趣的:(mysql)