From 3fa9a2add6b49c335a5e4dda71712fdd182f16f5 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Wed, 5 Nov 2025 06:38:24 -0800 Subject: [PATCH] Refactor agent service control in zabbix.sh (#8881) Replaces conditional logic for stopping and starting Zabbix agent services with a variable ($AGENT_SERVICE), simplifying service management. --- ct/zabbix.sh | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/ct/zabbix.sh b/ct/zabbix.sh index 40edecc3a..cbde042d3 100644 --- a/ct/zabbix.sh +++ b/ct/zabbix.sh @@ -42,12 +42,8 @@ function update_script() { fi msg_info "Stopping Services" - $STD systemctl stop zabbix-server - if systemctl list-unit-files | grep -q zabbix-agent2; then - $STD systemctl stop zabbix-agent2 - else - $STD systemctl stop zabbix-agent - fi + systemctl stop zabbix-server + systemctl stop "$AGENT_SERVICE" msg_ok "Stopped Services" msg_info "Updating Zabbix" @@ -88,12 +84,8 @@ function update_script() { msg_ok "Updated Zabbix" msg_info "Starting Services" - $STD systemctl start zabbix-server - if systemctl list-unit-files | grep -q zabbix-agent2; then - $STD systemctl start zabbix-agent2 - else - $STD systemctl start zabbix-agent - fi + systemctl start zabbix-server + systemctl start "$AGENT_SERVICE" systemctl restart apache2 msg_ok "Started Services"