Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DB_USER=replc
- DB_PASS="your_password"
- alert_to="your_email@address.org"
- alert_cc=""
- alert_subject="REPLICATION FAILED"
- alert_message="one of the replication threads on\
- the slave server failed or the server is down\n";
- rf=$(mktemp)
- echo "show slave status\G"|\
- mysql -u $DB_USER --password=$DB_PASS > $rf 2>&1
- repl_IO=$(cat $rf|grep "Slave_IO_Running"|cut -f2 -d':')
- repl_SQL=$(cat $rf|grep "Slave_SQL_Running"|cut -f2 -d':')
- if [ "$repl_IO" != " Yes" -o "$repl_SQL" != " Yes" ] ; then
- if [ "$alert_cc" != "" ] ; then
- cc=" -c $alert_cc "
- fi
- cat <<EOF | mail -s "$alert_subject" $alert_to $cc
- $alert_message
- return from slave status command:
- $(cat $rf)
- EOF
- rm $rf
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement