Blob Blame History Raw
From ac430f79c333d73e6cd59ae59178c7040e7dbfda Mon Sep 17 00:00:00 2001
From: Kazunori INOUE <kazunori_inoue@newson.co.jp>
Date: Wed, 8 May 2019 18:23:59 +0900
Subject: [PATCH] pgsql: enhance checks in pgsql_real_start to prevent
 incorrect status gets

---
 heartbeat/pgsql | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/heartbeat/pgsql b/heartbeat/pgsql
index 842dc0ac4..5d04618e6 100755
--- a/heartbeat/pgsql
+++ b/heartbeat/pgsql
@@ -483,7 +483,7 @@ runasowner() {
             "-q")
                 quietrun="-q"
                 shift 1;;
-            "warn"|"err")
+            "info"|"warn"|"err")
                 loglevel="-$1"
                 shift 1;;
             *)
@@ -544,7 +544,9 @@ pgsql_real_start() {
     local postgres_options
     local rc
 
-    if pgsql_status; then
+    pgsql_real_monitor info
+    rc=$?
+    if [ $rc -eq $OCF_SUCCESS -o $rc -eq $OCF_RUNNING_MASTER ]; then
         ocf_log info "PostgreSQL is already running. PID=`cat $PIDFILE`"
         if is_replication; then
             return $OCF_ERR_GENERIC