Blob Blame History Raw
From 08ed464aa803f03cbb6cabc79afe462fc98ad213 Mon Sep 17 00:00:00 2001
From: Fabian Herschel <fabian.herschel@suse.com>
Date: Mon, 5 Dec 2022 18:13:36 +0100
Subject: [PATCH 1/2] SAPInstance: be more resilient against broken kill.sap
 files

---
 heartbeat/SAPInstance | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/heartbeat/SAPInstance b/heartbeat/SAPInstance
index e3fe788ae..fbf6c5245 100755
--- a/heartbeat/SAPInstance
+++ b/heartbeat/SAPInstance
@@ -830,7 +830,7 @@ sapinstance_status() {
   local pids
 
   [ ! -f "/usr/sap/$SID/$InstanceName/work/kill.sap" ] && return $OCF_NOT_RUNNING
-  pids=`grep '^kill -[0-9]' /usr/sap/$SID/$InstanceName/work/kill.sap | awk '{print $3}'`
+  pids=$(awk '$3 ~ "[0-9]+" { print $3 }' /usr/sap/$SID/$InstanceName/work/kill.sap)
   for pid in $pids
   do
     [ `pgrep -f -U $sidadm $InstanceName | grep -c $pid` -gt 0 ] && return $OCF_SUCCESS

From a7153dd3f31fe5a14bf76d367cd8185848821fcd Mon Sep 17 00:00:00 2001
From: Fabian Herschel <fabian.herschel@suse.com>
Date: Tue, 6 Dec 2022 09:15:56 +0100
Subject: [PATCH 2/2] SAPInstance: Also need the begin-end markers

---
 heartbeat/SAPInstance | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/heartbeat/SAPInstance b/heartbeat/SAPInstance
index fbf6c5245..26fd54136 100755
--- a/heartbeat/SAPInstance
+++ b/heartbeat/SAPInstance
@@ -830,7 +830,7 @@ sapinstance_status() {
   local pids
 
   [ ! -f "/usr/sap/$SID/$InstanceName/work/kill.sap" ] && return $OCF_NOT_RUNNING
-  pids=$(awk '$3 ~ "[0-9]+" { print $3 }' /usr/sap/$SID/$InstanceName/work/kill.sap)
+  pids=$(awk '$3 ~ "^[0-9]+$" { print $3 }' /usr/sap/$SID/$InstanceName/work/kill.sap)
   for pid in $pids
   do
     [ `pgrep -f -U $sidadm $InstanceName | grep -c $pid` -gt 0 ] && return $OCF_SUCCESS