Blob Blame History Raw
From e370845f41d39d93f76fa34502d62e2513d5eb73 Mon Sep 17 00:00:00 2001
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
Date: Wed, 29 May 2019 14:07:46 +0200
Subject: [PATCH] Squid: dont run pgrep -P without PID

---
 heartbeat/Squid.in | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/heartbeat/Squid.in b/heartbeat/Squid.in
index 0b3c8ea86..e62e7ee66 100644
--- a/heartbeat/Squid.in
+++ b/heartbeat/Squid.in
@@ -173,7 +173,9 @@ get_pids()
 	SQUID_PIDS[0]=$(pgrep -f "$PROCESS_PATTERN")
 
 	# Seek by child process
-	SQUID_PIDS[1]=$(pgrep -P ${SQUID_PIDS[0]})
+	if [[ -n "${SQUID_PIDS[0]}" ]]; then
+		SQUID_PIDS[1]=$(pgrep -P ${SQUID_PIDS[0]})
+	fi
 
 	if [[ -n "${SQUID_PIDS[1]}" ]]; then
 		typeset exe