From 57c5e755fb611387ed37418ef733b8373914e23d Mon Sep 17 00:00:00 2001 From: Esteban Mackay Q Date: Fri, 15 Dec 2023 20:19:43 -0500 Subject: [PATCH] update --- update-b.sh | 22 ++++++++++++++++++++++ update.sh | 23 ++++++++++++++++++++++- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/update-b.sh b/update-b.sh index 604e2a4..aed718f 100644 --- a/update-b.sh +++ b/update-b.sh @@ -6,7 +6,29 @@ if [[ $EUID -ne 0 ]]; then exit 1 fi #whiptail --title "FreeDMR Bridge - Update" --msgbox "scrip sin actualizaciones disponibles / scrip no updates available" 0 50 +SERVICIOS=("http.server-fdmr-b.service" "http.server-fdmr-b2.service") +for servicio in "${SERVICIOS[@]}"; do + # Verificar si el servicio existe + if systemctl list-unit-files --type=service | grep -q "^$servicio "; then + echo "El servicio $servicio existe." + + # Verificar si el servicio está activo + if systemctl is-active --quiet $servicio; then + echo "El servicio $servicio está activo. Deteniendo..." + sudo systemctl stop $servicio + else + echo "El servicio $servicio no está activo." + fi + + # Deshabilitar el servicio + echo "Deshabilitando el servicio $servicio..." + sudo systemctl disable $servicio + + else + echo "El servicio $servicio no existe." + fi +done ############## #!/bin/bash if ! grep -q "Web-Dashboar-name" "/opt/wdp7" > /dev/null 2>&1; then diff --git a/update.sh b/update.sh index ffcb209..53baf33 100644 --- a/update.sh +++ b/update.sh @@ -1,11 +1,32 @@ #!/bin/bash - # Verificar si el usuario tiene permisos de root if [[ $EUID -ne 0 ]]; then echo "Este script debe ejecutarse como usuario ROOT" exit 1 fi +SERVICIOS=("http.server-fdmr.service" "http.server-fdmr2.service") + +for servicio in "${SERVICIOS[@]}"; do + # Verificar si el servicio existe + if systemctl list-unit-files --type=service | grep -q "^$servicio "; then + echo "El servicio $servicio existe." + + # Verificar si el servicio está activo + if systemctl is-active --quiet $servicio; then + echo "El servicio $servicio está activo. Deteniendo..." + sudo systemctl stop $servicio + else + echo "El servicio $servicio no está activo." + fi + + # Deshabilitar el servicio + echo "Deshabilitando el servicio $servicio..." + sudo systemctl disable $servicio + else + echo "El servicio $servicio no existe." + fi +done ############## cd / ##################