From b5918a2abfe13d21a5984f084b20409216207383 Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@iml.unibe.ch>
Date: Thu, 21 Oct 2021 17:56:59 +0200
Subject: [PATCH] check_systemdservices - remove starting spaces in systemctl
 output (debian 11)

---
 check_systemdservices | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/check_systemdservices b/check_systemdservices
index 77abd0f..234d9ea 100755
--- a/check_systemdservices
+++ b/check_systemdservices
@@ -18,6 +18,7 @@
 # 2019-10-29  v1.0  <axel.hahn@iml.unibe.ch>
 # 2020-03-05  v1.1  <axel.hahn@iml.unibe.ch> switch to ph.* helper functions
 # 2020-04-02  v1.2  <axel.hahn@iml.unibe.ch> added ph.execIfReady in _init
+# 2021-10-21  v1.3  <axel.hahn@iml.unibe.ch> remove starting spaces in systemctl output
 # ================================================================================
 
 . `dirname $0`/inc_pluginfunctions
@@ -46,7 +47,7 @@ function _init(){
   rm -f ${tmpErrors} ${tmpOut} ${tmpOutOther} 2>/dev/null
   # systemctl --no-legend --no-pager --all --type service >${tmpServices}
   # systemctl --no-legend --no-pager --type service >${tmpServices}
-  ph.execIfReady "systemctl --no-legend --no-pager --type service" | grep -vf ${ignorefile} >${tmpServices}
+  ph.execIfReady "systemctl --no-legend --no-pager --type service" | sed "s#^\ *##g" | grep -vf ${ignorefile} >${tmpServices}
 }
 
 # get wanted services from service list
-- 
GitLab