[packages/zabbix] Try to get configured PidFile; rel 2

glen glen at pld-linux.org
Tue Aug 31 13:58:24 CEST 2021


commit c53084ae76cafad19cb642d084f2b2da1d8456c9
Author: Algirdas Stabingis <algirdas.stabingis at delfi.lt>
Date:   Tue Aug 31 14:57:59 2021 +0300

    Try to get configured PidFile; rel 2
    
    Signed-off-by: Elan Ruusamäe <glen at pld-linux.org>

 zabbix.spec        |  2 +-
 zabbix_agent2.init | 12 +++++++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/zabbix.spec b/zabbix.spec
index bccd76f..40ef47e 100644
--- a/zabbix.spec
+++ b/zabbix.spec
@@ -24,7 +24,7 @@ Summary:	Zabbix - network monitoring software
 Summary(pl.UTF-8):	Zabbix - oprogramowanie do monitorowania sieci
 Name:		zabbix
 Version:	5.4.3
-Release:	1
+Release:	2
 License:	GPL v2+
 Group:		Networking/Utilities
 # https://www.zabbix.com/download_sources
diff --git a/zabbix_agent2.init b/zabbix_agent2.init
index eb83ccf..eabb0d3 100755
--- a/zabbix_agent2.init
+++ b/zabbix_agent2.init
@@ -29,7 +29,17 @@ ZABBIX_USER=zabbix
 # Get service config - may override defaults
 [ -f /etc/sysconfig/zabbix_agent2 ] && . /etc/sysconfig/zabbix_agent2
 
-pidfile="/var/run/zabbix/zabbix_agent2.pid"
+# Try to get configured PidFile or set default
+get_pid() {
+	local config="$1"
+	local pidfile
+	test -f "$config" && pidfile=$(awk -F= '/^ *PidFile/ {print $2}' "$config")
+	# Fallback to zabbix_agent2 default pidfile
+	test -n "$pidfile" || pidfile=/tmp/zabbix_agent2.pid
+	echo "$pidfile"
+}
+
+pidfile=$(get_pid /etc/zabbix/zabbix_agent2.conf)
 
 start() {
 	# Check if the service is already running?
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/zabbix.git/commitdiff/c53084ae76cafad19cb642d084f2b2da1d8456c9



More information about the pld-cvs-commit mailing list