From b892aaa8242b07b760b665c690d864d597ae4735 Mon Sep 17 00:00:00 2001 From: "Esteban Mackay Q." Date: Sun, 2 Jun 2024 02:44:33 -0500 Subject: [PATCH] Update update.sh --- update.sh | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 55 insertions(+), 3 deletions(-) diff --git a/update.sh b/update.sh index 85627c0..ec082ec 100644 --- a/update.sh +++ b/update.sh @@ -284,7 +284,7 @@ then variable=0000 fi -SERVICIOS=("adn-server.service" "freedmr.service" "proxy.service" "adn-parrot.service" "fdmrparrot.service") +SERVICIOS=("adn-server.service" "freedmr.service" "proxy.service" "adn-parrot.service" "fdmrparrot.service" "adn_server.service" "adn_proxy.service" "adn_parrot.service") for servicio in "${SERVICIOS[@]}"; do # Verificar si el servicio existe @@ -493,7 +493,29 @@ variable4=$(grep "COLOR_1 =" /opt/FDMR-Monitor/fdmr-mon.cfg) variable5=$(grep "COLOR_2 =" /opt/FDMR-Monitor/fdmr-mon.cfg) ##################################### +SERVICIOS=("adn_dashboard.service" "apache2.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 sudo systemctl stop fdmr_mon2.service sudo systemctl stop fdmr_mon.service @@ -746,8 +768,12 @@ fi if [ -f "/etc/nginx/sites-enabled/freedmr" ]; then mv /etc/nginx/sites-enabled/freedmr /etc/nginx/sites-enabled/adn - sudo systemctl restart nginx fi +if ! systemctl status nginx.service |grep "service; enabled;" >/dev/null 2>&1 +then + systemctl enable nginx.service +fi +sudo systemctl restart nginx EOFB1 sudo chmod +x /opt/monitor-update.sh @@ -763,7 +789,29 @@ if ! grep -q "Web-Dashboar-name: adn" "/opt/wdp" > /dev/null 2>&1; then sed -i "s|Web-Dashboar-name:.*|Web-Dashboar-name: adn|g" /opt/wdp fi ############## +SERVICIOS=("adn_dashboard.service" "apache2.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 sudo systemctl stop fdmr_mon.service sudo systemctl stop fdmr_mon2.service @@ -968,8 +1016,12 @@ sh /opt/extra-3.sh if [ -f "/etc/nginx/sites-enabled/freedmr" ]; then mv /etc/nginx/sites-enabled/freedmr /etc/nginx/sites-enabled/adn - sudo systemctl restart nginx fi +if ! systemctl status nginx.service |grep "service; enabled;" >/dev/null 2>&1 +then + systemctl enable nginx.service +fi +sudo systemctl restart nginx EOFB2 sudo chmod +x /opt/monitor-update2.sh