From: Marcin Krol Date: Sun, 12 Feb 2023 12:09:43 +0000 (+0100) Subject: - wait for Zabbix server proces to exit when stopping service X-Git-Url: https://git.tld-linux.org/?a=commitdiff_plain;h=2340ed6b79b3410e0f885135eaca91f4c15a94a6;p=packages%2Fzabbix.git - wait for Zabbix server proces to exit when stopping service --- diff --git a/zabbix.spec b/zabbix.spec index 9175efb..a30dc25 100644 --- a/zabbix.spec +++ b/zabbix.spec @@ -17,7 +17,7 @@ Summary: Zabbix - network monitoring software Summary(pl.UTF-8): Zabbix - oprogramowanie do monitorowania sieci Name: zabbix Version: 6.0.13 -Release: 2 +Release: 3 License: GPL v2+ Group: Networking/Utilities Source0: https://cdn.zabbix.com/zabbix/sources/stable/6.0/%{name}-%{version}.tar.gz diff --git a/zabbix_agentd.init b/zabbix_agentd.init old mode 100755 new mode 100644 diff --git a/zabbix_proxy.init b/zabbix_proxy.init old mode 100755 new mode 100644 diff --git a/zabbix_server.init b/zabbix_server.init old mode 100755 new mode 100644 index e98e121..a5c5f56 --- a/zabbix_server.init +++ b/zabbix_server.init @@ -27,6 +27,9 @@ fi # Get service config - may override defaults [ -f /etc/sysconfig/zabbix_server ] && . /etc/sysconfig/zabbix_server +# Set default shutdown timeout if it is not set in service config +ZABBIX_SHUTDOWN_TIMEOUT=${ZABBIX_SHUTDOWN_TIMEOUT:-60} + pidfile="/var/run/zabbix/zabbix_server.pid" start() { @@ -51,6 +54,24 @@ stop() { # Stop daemons. msg_stopping "Zabbix Server" killproc --pidfile $pidfile zabbix_server -TERM + + if [ -f "$pidfile" ]; then + show "Waiting for Zabbix Server to stop" + busy + + timeout=0 + while : ; do + [ ! -f "$pidfile" ] || break + if [ $timeout -ge $ZABBIX_SHUTDOWN_TIMEOUT ]; then + RETVAL=1 + break + fi + sleep 1 && echo -n "." + timeout=$((timeout+1)) + done + ok + fi + rm -f /var/lock/subsys/zabbix_server }