From 1e78e69c512fe66aeedfb5901f69daafc8b71d15 Mon Sep 17 00:00:00 2001 From: "Esteban Mackay Q." Date: Thu, 6 Feb 2025 22:30:18 -0500 Subject: [PATCH] Update install.sh --- install.sh | 58 +++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 18 deletions(-) diff --git a/install.sh b/install.sh index 70f8a18..ca70b15 100644 --- a/install.sh +++ b/install.sh @@ -97,6 +97,14 @@ for servicio in $SERVICIOS; do fi done +if [ -f "/lib/systemd/system/adn-parrot.service" ]; +then + rm /lib/systemd/system/adn-parrot.service +fi +if [ -f "/lib/systemd/system/adn_parrot.service" ]; +then + rm /lib/systemd/system/adn_parrot.service +fi if [ -f "/lib/systemd/system/fdmrparrot.service" ]; then rm /lib/systemd/system/fdmrparrot.service @@ -486,27 +494,41 @@ WantedBy=multi-user.target EOF ### -sudo cat > /lib/systemd/system/adn-parrot.service <<- "EOF" -[Unit] -Description=Freedmr Parrot -After=network-online.target syslog.target -Wants=network-online.target +servicios="adn-parrot.service adn_parrot.service fdmrparrot.service" + +# Recorre la lista de servicios y deshabilita y detiene sin enviar mensaje +for servicio in $servicios; do + # Verifica si el servicio existe antes de intentar deshabilitarlo y detenerlo + if systemctl list-unit-files --type=service | grep -q "^$servicio"; then + sudo systemctl disable --quiet "$servicio" + sudo systemctl stop --quiet "$servicio" + fi + + # Verifica si el archivo del servicio existe antes de intentar eliminarlo + if [ -f /lib/systemd/system/"$servicio" ]; then + sudo rm /lib/systemd/system/"$servicio" + fi +done +#sudo cat > /lib/systemd/system/adn-parrot.service <<- "EOF" +#[Unit] +#Description=Freedmr Parrot +#After=network-online.target syslog.target +#Wants=network-online.target -[Service] -User=root -Type=simple -Restart=always -RestartSec=3 -StandardOutput=null -WorkingDirectory=/opt/ADN-DMR-Peer-Server -ExecStart=/usr/bin/python3 /opt/ADN-DMR-Peer-Server/playback.py -c /opt/ADN-DMR-Peer-Server/config/parrot.cfg -#Restart=on-abort -#Restart=on-failure +#[Service] +#User=root +#Type=simple +#Restart=always +#RestartSec=3 +#StandardOutput=null +#WorkingDirectory=/opt/ADN-DMR-Peer-Server +#ExecStart=/usr/bin/python3 /opt/ADN-DMR-Peer-Server/playback.py -c /opt/ADN-DMR-Peer-Server/config/parrot.cfg -[Install] -WantedBy=multi-user.target -EOF +#[Install] +#WantedBy=multi-user.target + +#EOF # sudo cat > /lib/systemd/system/fdmr_mon.service <<- "EOF" [Unit]