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 / ##################