From 2f807aaf5b312b53c60836543922c2675d771b2c Mon Sep 17 00:00:00 2001 From: Gea-Suan Lin Date: Sat, 22 Aug 2015 11:39:42 +0800 Subject: [PATCH] Import mysql-heartbeat. --- mysql-heartbeat | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 mysql-heartbeat diff --git a/mysql-heartbeat b/mysql-heartbeat new file mode 100755 index 0000000..933c997 --- /dev/null +++ b/mysql-heartbeat @@ -0,0 +1,21 @@ +#!/bin/sh + +# 沒有 my.cnf 的時候就不要檢查 +if [ ! -r /etc/mysql/my.cnf ]; then + exit +fi + +# 沒有 heartbeat 的時候就不要檢查 +if [ ! -r /etc/ha.d/ha.cf ]; then + exit +fi + +CL="$(/usr/bin/cl_status rscstatus 2>&1)" + +# DRBD 中只需要處理當 Heartbeat 確定拿到資源,但 mysql 沒起來的 case + +if /sbin/ifconfig -s | /usr/bin/awk '{print $1}' | /bin/grep : > /dev/null 2>&1; then + if ! /bin/ps -U mysql | /bin/grep mysqld > /dev/null 2>&1; then + /usr/share/heartbeat/hb_standby > /dev/null 2>&1 + fi +fi