diff --git a/ct/zabbix.sh b/ct/zabbix.sh index 074489594..43ce54de2 100644 --- a/ct/zabbix.sh +++ b/ct/zabbix.sh @@ -42,7 +42,12 @@ function update_script() { fi msg_info "Stopping Services" - systemctl stop zabbix-server $AGENT_SERVICE + $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 msg_ok "Stopped Services" msg_info "Updating Zabbix" @@ -83,14 +88,22 @@ function update_script() { msg_ok "Updated Zabbix" msg_info "Starting Services" - systemctl start zabbix-server $AGENT_SERVICE + $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 restart apache2 msg_ok "Started Services" msg_info "Cleaning Up" rm -rf /tmp/zabbix-release_latest+debian13_all.deb + $STD apt -y autoremove + $STD apt -y autoclean + $STD apt -y clean msg_ok "Cleaned" - msg_ok "Updated Successfully" + msg_ok "Updated Successfully!" exit } diff --git a/install/zabbix-install.sh b/install/zabbix-install.sh index a623ccb99..8a9a76210 100644 --- a/install/zabbix-install.sh +++ b/install/zabbix-install.sh @@ -102,8 +102,14 @@ fi msg_ok "Configured Fping" msg_info "Starting Services" -systemctl restart zabbix-server zabbix-agent2 apache2 -systemctl enable -q --now zabbix-server zabbix-agent2 apache2 +if [ "$AGENT_PKG" = "zabbix-agent2" ]; then + AGENT_SERVICE="zabbix-agent2" +else + AGENT_SERVICE="zabbix-agent" +fi + +systemctl restart zabbix-server +systemctl enable -q --now zabbix-server $AGENT_SERVICE apache2 msg_ok "Started Services" motd_ssh