From 1d446e7758e9f8ec47ad4da48c72baefb2725d25 Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@iml.unibe.ch>
Date: Mon, 22 Mar 2021 22:16:07 +0100
Subject: [PATCH] more strict check for currently running instance

---
 director-cli.sh | 3 ++-
 icinga-cli.sh   | 2 +-
 plugins         | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/director-cli.sh b/director-cli.sh
index a6c9498..3c14028 100755
--- a/director-cli.sh
+++ b/director-cli.sh
@@ -78,7 +78,8 @@ IDC_svcathost__cachefile="${dir_data}/services_on_host__at-director.txt"
     # local MY_OSName=`facter os -y | grep " distid:" | cut -f 2 -d ":" | cut -f 2 -d " " | tr '[:upper:]' '[:lower:]'`
     # local MY_OSMajorVersion=`facter os -y | grep " majdistrelease:" | cut -f 2 -d ":" | cut -f 2 -d "'"`
 
-    local MY_Platform=`facter kernel | tr '[:upper:]' '[:lower:]'`
+    # local MY_Platform=`facter kernel | tr '[:upper:]' '[:lower:]'`
+    local MY_Platform=`uname -a | cut -f 1 -d ' '`
     . `dirname $0`/plugins/inc_pluginfunctions
     local MY_OSName=`ph.getOS`
     local MY_OSMajorVersion=`ph.getOSMajor`
diff --git a/icinga-cli.sh b/icinga-cli.sh
index dc7844f..4f55839 100755
--- a/icinga-cli.sh
+++ b/icinga-cli.sh
@@ -101,7 +101,7 @@ function loopChecks(){
       local snapShotCurrent=${dir_data}/`basename $0`-last.fingerprint
       if [ -f "${lockfile}" ]; then
         local lockpid=`cat "${lockfile}" | cut -f 2 -d "-" | cut -f 4 -d " " | grep "[0-9]"`
-        ps -f --pid $lockpid >/dev/null
+        ps -f --pid $lockpid | grep "`basename $0`" | grep loop >/dev/null
         if [ $? -eq 0 ]; then
           _log "ABORT: Loop seems to run already. See process with PID $lockpid"
           echo
diff --git a/plugins b/plugins
index 7591e74..ee916f1 160000
--- a/plugins
+++ b/plugins
@@ -1 +1 @@
-Subproject commit 7591e7456609b9313937662bfce4823669f60eda
+Subproject commit ee916f183663f7a694490cf91ea6f0c3d64b59bf
-- 
GitLab