mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-11-17 19:16:25 +00:00
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
This commit is contained in:
@@ -19,7 +19,9 @@ LOCAL_VERSION_FILE="$BASE_DIR/version.txt"
|
|||||||
INSTALL_DIR="/usr/local/bin"
|
INSTALL_DIR="/usr/local/bin"
|
||||||
MENU_SCRIPT="menu"
|
MENU_SCRIPT="menu"
|
||||||
VENV_PATH="/opt/googletrans-env"
|
VENV_PATH="/opt/googletrans-env"
|
||||||
|
|
||||||
MONITOR_SERVICE="proxmenux-monitor.service"
|
MONITOR_SERVICE="proxmenux-monitor.service"
|
||||||
|
MONITOR_UNIT_FILE="/etc/systemd/system/${MONITOR_SERVICE}"
|
||||||
|
|
||||||
if [[ -f "$UTILS_FILE" ]]; then
|
if [[ -f "$UTILS_FILE" ]]; then
|
||||||
source "$UTILS_FILE"
|
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() {
|
detect_installation_type() {
|
||||||
local has_venv=false
|
local has_venv=false
|
||||||
local has_language=false
|
local has_language=false
|
||||||
@@ -400,6 +437,9 @@ uninstall_proxmenu() {
|
|||||||
done
|
done
|
||||||
apt-get autoremove -y --purge >/dev/null 2>&1
|
apt-get autoremove -y --purge >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "80" ; echo "Removing ProxMenux Monitor..."
|
||||||
|
uninstall_proxmenux_monitor
|
||||||
|
|
||||||
echo "90" ; echo "Restoring system files..."
|
echo "90" ; echo "Restoring system files..."
|
||||||
# Restore .bashrc and motd
|
# Restore .bashrc and motd
|
||||||
|
|||||||
Reference in New Issue
Block a user