From d345f9651827228b208400918cbe22d7923b7280 Mon Sep 17 00:00:00 2001 From: cod378 Date: Fri, 14 Nov 2025 01:49:39 +0000 Subject: [PATCH] feat: add ProxMenux Monitor uninstallation to config menu - Add uninstall_proxmenux_monitor() function with systemd service cleanup - Stop and disable monitor service if active - Remove systemd unit file and reload daemon - Integrate monitor uninstallation into main uninstall_proxmenu() workflow - Define MONITOR_UNIT_FILE constant for service file path --- scripts/menus/config_menu.sh | 40 ++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/scripts/menus/config_menu.sh b/scripts/menus/config_menu.sh index eaab541..792a38b 100644 --- a/scripts/menus/config_menu.sh +++ b/scripts/menus/config_menu.sh @@ -19,7 +19,9 @@ LOCAL_VERSION_FILE="$BASE_DIR/version.txt" INSTALL_DIR="/usr/local/bin" MENU_SCRIPT="menu" VENV_PATH="/opt/googletrans-env" + MONITOR_SERVICE="proxmenux-monitor.service" +MONITOR_UNIT_FILE="/etc/systemd/system/${MONITOR_SERVICE}" if [[ -f "$UTILS_FILE" ]]; then source "$UTILS_FILE" @@ -30,6 +32,41 @@ initialize_cache # ========================================================== +uninstall_proxmenux_monitor() { + + # 1. Stop service if it is running + if systemctl is-active --quiet "${MONITOR_SERVICE_NAME}"; then + echo " - Stoping service..." + systemctl stop "${MONITOR_SERVICE_NAME}" + else + echo " - Service is not running (ok)" + fi + + # 2. Disable service if enabled + if systemctl is-enabled --quiet "${MONITOR_SERVICE_NAME}"; then + echo " - Disabling service..." + systemctl disable "${MONITOR_SERVICE_NAME}" + else + echo " - Service is not enabled (ok)" + fi + + # 3. Remove unit file + if [ -f "${MONITOR_UNIT_FILE}" ]; then + echo " - Removing unit file ${MONITOR_UNIT_FILE}..." + rm -f "${MONITOR_UNIT_FILE}" + else + echo " - Unit file ${MONITOR_UNIT_FILE} does not exist (ok)" + fi + + # 4. Reload systemd + echo " - Recargando systemd..." + systemctl daemon-reload + systemctl reset-failed || true + + echo "==> Service ${MONITOR_SERVICE_NAME} uninstalled." + +} + detect_installation_type() { local has_venv=false local has_language=false @@ -400,6 +437,9 @@ uninstall_proxmenu() { done apt-get autoremove -y --purge >/dev/null 2>&1 fi + + echo "80" ; echo "Removing ProxMenux Monitor..." + uninstall_proxmenux_monitor echo "90" ; echo "Restoring system files..." # Restore .bashrc and motd