Blame SOURCES/bz2151296-SAPInstance-improve-killsap-logic.patch

3fb381
From 08ed464aa803f03cbb6cabc79afe462fc98ad213 Mon Sep 17 00:00:00 2001
3fb381
From: Fabian Herschel <fabian.herschel@suse.com>
3fb381
Date: Mon, 5 Dec 2022 18:13:36 +0100
3fb381
Subject: [PATCH 1/2] SAPInstance: be more resilient against broken kill.sap
3fb381
 files
3fb381
3fb381
---
3fb381
 heartbeat/SAPInstance | 2 +-
3fb381
 1 file changed, 1 insertion(+), 1 deletion(-)
3fb381
3fb381
diff --git a/heartbeat/SAPInstance b/heartbeat/SAPInstance
3fb381
index e3fe788ae..fbf6c5245 100755
3fb381
--- a/heartbeat/SAPInstance
3fb381
+++ b/heartbeat/SAPInstance
3fb381
@@ -830,7 +830,7 @@ sapinstance_status() {
3fb381
   local pids
3fb381
 
3fb381
   [ ! -f "/usr/sap/$SID/$InstanceName/work/kill.sap" ] && return $OCF_NOT_RUNNING
3fb381
-  pids=`grep '^kill -[0-9]' /usr/sap/$SID/$InstanceName/work/kill.sap | awk '{print $3}'`
3fb381
+  pids=$(awk '$3 ~ "[0-9]+" { print $3 }' /usr/sap/$SID/$InstanceName/work/kill.sap)
3fb381
   for pid in $pids
3fb381
   do
3fb381
     [ `pgrep -f -U $sidadm $InstanceName | grep -c $pid` -gt 0 ] && return $OCF_SUCCESS
3fb381
3fb381
From a7153dd3f31fe5a14bf76d367cd8185848821fcd Mon Sep 17 00:00:00 2001
3fb381
From: Fabian Herschel <fabian.herschel@suse.com>
3fb381
Date: Tue, 6 Dec 2022 09:15:56 +0100
3fb381
Subject: [PATCH 2/2] SAPInstance: Also need the begin-end markers
3fb381
3fb381
---
3fb381
 heartbeat/SAPInstance | 2 +-
3fb381
 1 file changed, 1 insertion(+), 1 deletion(-)
3fb381
3fb381
diff --git a/heartbeat/SAPInstance b/heartbeat/SAPInstance
3fb381
index fbf6c5245..26fd54136 100755
3fb381
--- a/heartbeat/SAPInstance
3fb381
+++ b/heartbeat/SAPInstance
3fb381
@@ -830,7 +830,7 @@ sapinstance_status() {
3fb381
   local pids
3fb381
 
3fb381
   [ ! -f "/usr/sap/$SID/$InstanceName/work/kill.sap" ] && return $OCF_NOT_RUNNING
3fb381
-  pids=$(awk '$3 ~ "[0-9]+" { print $3 }' /usr/sap/$SID/$InstanceName/work/kill.sap)
3fb381
+  pids=$(awk '$3 ~ "^[0-9]+$" { print $3 }' /usr/sap/$SID/$InstanceName/work/kill.sap)
3fb381
   for pid in $pids
3fb381
   do
3fb381
     [ `pgrep -f -U $sidadm $InstanceName | grep -c $pid` -gt 0 ] && return $OCF_SUCCESS