From a10cb6a8b5d57569f3f220997b7d8197ac8c6dfc Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@iml.unibe.ch>
Date: Mon, 14 Mar 2022 13:43:09 +0100
Subject: [PATCH] fix isInteractiveShell; less output for service

---
 icinga-cli.sh    | 1 -
 inc_functions.sh | 8 ++++----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/icinga-cli.sh b/icinga-cli.sh
index bd65875..c79648e 100755
--- a/icinga-cli.sh
+++ b/icinga-cli.sh
@@ -172,7 +172,6 @@ function processAllChecks(){
 
   _log ""
   _log "------ looping over all checks"
-  getChecks
   for myconfig in $(getChecks)
   do
     iCounter=$iCounter+1
diff --git a/inc_functions.sh b/inc_functions.sh
index 2b97b69..8d3cee5 100644
--- a/inc_functions.sh
+++ b/inc_functions.sh
@@ -6,7 +6,7 @@
 # ======================================================================
 
   isInteractiveShell=false
-  test -n "$PS1" && isInteractiveShell=true
+  test $PPID -ne 1 && isInteractiveShell=true
 
   # ..................................................................
   # write debug output to STDERR
@@ -248,12 +248,12 @@ function _getIpPrivate(){
 
     http.makeRequest "$1" "$2" "$3"
     if http.isServerError >/dev/null; then
-      echo "CRITICAL ERROR: API request failed with a server error $1 $2"
+      _elog "CRITICAL ERROR: API request failed with a server error $1 $2"
       exit 1
     fi
 
-    http.getResponseHeader
-    http.getResponse
+    _echo "$( http.getResponseHeader )"
+    _echo $( http.getResponse )
 
   }
 
-- 
GitLab