From 48eed8dca46e6e7ec46565c8dd9d79e70bd9c1ea Mon Sep 17 00:00:00 2001 From: Esteban Mackay Q Date: Sat, 9 Dec 2023 21:27:03 -0500 Subject: [PATCH] update --- easy-fdmr.sh | 5 +--- fdmr-bridge.sh | 52 +++++++--------------------------- install.sh | 47 ------------------------------- update-b.sh | 21 ++++++++++++++ update.sh | 76 ++++++++------------------------------------------ 5 files changed, 44 insertions(+), 157 deletions(-) diff --git a/easy-fdmr.sh b/easy-fdmr.sh index 778ec5c..5c596d3 100644 --- a/easy-fdmr.sh +++ b/easy-fdmr.sh @@ -84,15 +84,12 @@ rustup default 1.72.0 echo "Instalación completa." ####### +bash -c "$(curl -fsSLk https://gitlab.com/hp3icc/emq-TE1/-/raw/main/install/nginx.sh)" bash -c "$(curl -fsSLk https://gitlab.com/hp3icc/fdmr/-/raw/main/install.sh)" sudo systemctl start freedmr.service sudo systemctl enable freedmr.service sudo systemctl start proxy.service sudo systemctl enable proxy.service -sudo systemctl start fdmr_mon.service -sudo systemctl enable fdmr_mon.service sudo systemctl start fdmrparrot.service sudo systemctl enable fdmrparrot.service -sudo systemctl start http.server-fdmr.service -sudo systemctl enable http.server-fdmr.service menu-fdmr \ No newline at end of file diff --git a/fdmr-bridge.sh b/fdmr-bridge.sh index ef78388..751a272 100644 --- a/fdmr-bridge.sh +++ b/fdmr-bridge.sh @@ -432,23 +432,6 @@ sh /opt/FDMR-Monitor-B/sysinfo/rrd-db.sh ################## #Service ########## -sudo cat > /lib/systemd/system/http.server-fdmr-b.service <<- "EOF" -[Unit] -Description=PHP http.server.fdmr -After=network.target - -[Service] -#User=root -#ExecStartPre=/bin/sleep 30 -# Modify for different other port -ExecStart=php -S 0.0.0.0:80 -t /var/www/fdmr-b/ -Restart=on-failure - -[Install] -WantedBy=multi-user.target - -EOF -# sudo cat > /lib/systemd/system/proxy2.service <<- "EOF" [Unit] Description= Proxy Service Bridge @@ -512,20 +495,21 @@ if [ -d "/opt/FDMR-Monitor-B2" ] then rm -r /opt/FDMR-Monitor-B2 fi -if [ -f "/opt/wdp7" ] -then - echo "found file" -else -sudo cat > /opt/wdp7 <<- "EOFX" -######################################### -# Select number port, FreeDMR Dashboard # -######################################### +if ! grep -q "Web-Dashboar-name" "/opt/wdp7" > /dev/null 2>&1; then +cat > /opt/wdp7 <<- "EOFX" +################################################ +# Select number port, FreeDMR-Bridge Dashboard # +################################################ +Web-Dashboar-name: freedmr-bidge Web-Dashboar-Port: 80 +Web-Dashboar-dns: +Web-Dashboar-dir: /var/www/fdmr-b2 +Web-Dashboar-select: fdmr_mon-b2 +Web-Dashboar-soft: /opt/FDMR-Monitor-B2 EOFX fi - cd /opt sudo git clone https://github.com/CS8ABG/FDMR-Monitor.git /opt/FDMR-Monitor-B2 cd /opt/FDMR-Monitor-B2 @@ -587,21 +571,5 @@ sudo chown www-data:www-data /var/www/fdmr-b2/ -R #python3 mon_db.py --create #python3 mon_db.py --update -sudo cat > /lib/systemd/system/http.server-fdmr-b2.service <<- "EOF" -[Unit] -Description=PHP http.server.fdmr-b2 -After=network.target - -[Service] -#User=root -#ExecStartPre=/bin/sleep 30 -# Modify for different other port -ExecStart=php -S 0.0.0.0:80 -t /var/www/fdmr-b2/ -Restart=on-failure - -[Install] -WantedBy=multi-user.target - -EOF ############################# sudo systemctl daemon-reload diff --git a/install.sh b/install.sh index 624bd5b..879f565 100644 --- a/install.sh +++ b/install.sh @@ -771,23 +771,6 @@ Restart=on-failure [Install] WantedBy=multi-user.target -EOF -# -sudo cat > /lib/systemd/system/http.server-fdmr.service <<- "EOF" -[Unit] -Description=PHP http.server.fdmr -After=network.target - -[Service] -#User=root -#ExecStartPre=/bin/sleep 30 -# Modify for different other port -ExecStart=php -S 0.0.0.0:80 -t /var/www/fdmr/ -Restart=on-failure - -[Install] -WantedBy=multi-user.target - EOF # sudo cat > /lib/systemd/system/fdmr_mon.service <<- "EOF" @@ -823,20 +806,6 @@ sh /opt/extra-1.sh sh /opt/extra-2.sh #################################################################### #monitor2 -if [ -f "/opt/wdp" ] -then - echo "found file" -else -sudo cat > /opt/wdp <<- "EOFX" -######################################### -# Select number port, FreeDMR Dashboard # -######################################### - -Web-Dashboar-Port: 80 - -EOFX -fi - cd /opt sudo git clone https://github.com/CS8ABG/FDMR-Monitor.git /opt/FDMR-Monitor2 cd /opt/FDMR-Monitor2 @@ -927,22 +896,6 @@ cd /opt/FDMR-Monitor2 #python3 mon_db.py --create #python3 mon_db.py --update -sudo cat > /lib/systemd/system/http.server-fdmr2.service <<- "EOF" -[Unit] -Description=PHP http.server.fdmr2 -After=network.target - -[Service] -#User=root -#ExecStartPre=/bin/sleep 30 -# Modify for different other port -ExecStart=php -S 0.0.0.0:80 -t /var/www/fdmr2/ -Restart=on-failure - -[Install] -WantedBy=multi-user.target - -EOF ############################# sudo systemctl daemon-reload diff --git a/update-b.sh b/update-b.sh index d2b4892..604e2a4 100644 --- a/update-b.sh +++ b/update-b.sh @@ -5,6 +5,27 @@ if [[ $EUID -ne 0 ]]; then echo "Este script debe ejecutarse como usuario ROOT" exit 1 fi +#whiptail --title "FreeDMR Bridge - Update" --msgbox "scrip sin actualizaciones disponibles / scrip no updates available" 0 50 ############## +#!/bin/bash +if ! grep -q "Web-Dashboar-name" "/opt/wdp7" > /dev/null 2>&1; then + sudo cat > /opt/wdp7 <<- "EOFX" +################################################ +# Select number port, FreeDMR-Bridge Dashboard # +################################################ + +Web-Dashboar-name: freedmr-bidge +Web-Dashboar-Port: 80 +Web-Dashboar-dns: +Web-Dashboar-dir: /var/www/fdmr-b2 +Web-Dashboar-select: fdmr_mon-b2 +Web-Dashboar-soft: /opt/FDMR-Monitor-B2 + +EOFX +fi +if [ -f "/etc/nginx/sites-available/000" ]; then +bash -c "$(curl -fsSLk https://gitlab.com/hp3icc/emq-TE1/-/raw/main/install/nginx.sh)" +fi +bash -c "$(curl -fsSLk https://gitlab.com/hp3icc/emq-TE1/-/raw/main/menu/menu-fdmr-bridge)" whiptail --title "FreeDMR Bridge - Update" --msgbox "scrip sin actualizaciones disponibles / scrip no updates available" 0 50 diff --git a/update.sh b/update.sh index ae6e847..ffcb209 100644 --- a/update.sh +++ b/update.sh @@ -8,21 +8,27 @@ fi ############## cd / - ################## -if [ -f "/opt/wdp" ] -then - echo "found file" -else -sudo cat > /opt/wdp <<- "EOFX" +#!/bin/bash +if ! grep -q "Web-Dashboar-name" "/opt/wdp" > /dev/null 2>&1; then + sudo cat > /opt/wdp <<- "EOFX" #!/bin/bash ######################################### # Select number port, FreeDMR Dashboard # ######################################### +Web-Dashboar-name: freedmr Web-Dashboar-Port: 80 +Web-Dashboar-dns: +Web-Dashboar-dir: /var/www/fdmr2 +Web-Dashboar-select: fdmr_mon2 +Web-Dashboar-soft: /opt/FDMR-Monitor2 + EOFX fi +if [ -f "/etc/nginx/sites-available/000" ]; then +bash -c "$(curl -fsSLk https://gitlab.com/hp3icc/emq-TE1/-/raw/main/install/nginx.sh)" +fi if [ -f "/opt/extra-1.sh" ] then echo "found file" @@ -616,8 +622,6 @@ variable5=$(grep "COLOR_2 =" /opt/FDMR-Monitor/fdmr-mon.cfg) ##################################### -sudo systemctl stop http.server-fdmr2.service -sudo systemctl stop http.server-fdmr.service sudo systemctl stop fdmr_mon2.service sudo systemctl stop fdmr_mon.service sudo systemctl stop proxy.service @@ -648,22 +652,6 @@ Restart=on-failure [Install] WantedBy=multi-user.target -EOF -cat > /lib/systemd/system/http.server-fdmr.service <<- "EOF" -[Unit] -Description=PHP http.server.fdmr -After=network.target - -[Service] -#User=root -#ExecStartPre=/bin/sleep 30 -# Modify for different other port -ExecStart=php -S 0.0.0.0:80 -t /var/www/fdmr/ -Restart=on-failure - -[Install] -WantedBy=multi-user.target - EOF # if [ -d "/var/www/fdmr" ] @@ -1113,11 +1101,6 @@ fi if systemctl status mariadb.service |grep disable >/dev/null 2>&1 then sudo systemctl enable mariadb.service -fi -sudo systemctl disable http.server-fdmr2.service -if ! systemctl status http.server-fdmr.service | grep "service; enabled;" >/dev/null 2>&1; then - sudo systemctl enable http.server-fdmr.service - fi sudo systemctl disable fdmr_mon2.service if ! systemctl status fdmr_mon.service | grep "service; enabled;" >/dev/null 2>&1; then @@ -1130,17 +1113,9 @@ fi ############## - variable1=$(grep "Web-Dashboar-Port:" /opt/wdp | grep -Eo '[A.0-9]{1,9}') && - if [ -z "$variable1" ] - then variable1=80 - - fi && - sudo sed -i "s/ExecStart=.*/ExecStart=php -S 0.0.0.0:$variable1 -t \/var\/www\/fdmr\//g" /lib/systemd/system/http.server-fdmr.service && - sudo sed -i "s/ExecStart=.*/ExecStart=php -S 0.0.0.0:$variable1 -t \/var\/www\/fdmr2\//g" /lib/systemd/system/http.server-fdmr2.service && systemctl daemon-reload && systemctl start fdmr_mon.service systemctl start proxy.service - systemctl start http.server-fdmr.service sh /opt/extra-2.sh (crontab -l; echo "* */1 * * * sync ; echo 3 > /proc/sys/vm/drop_caches >/dev/null 2>&1")|awk '!x[$0]++'|crontab - @@ -1165,8 +1140,6 @@ fi ############## cd / -sudo systemctl stop http.server-fdmr.service -sudo systemctl stop http.server-fdmr2.service sudo systemctl stop fdmr_mon.service sudo systemctl stop fdmr_mon2.service sudo systemctl stop proxy.service @@ -1175,22 +1148,6 @@ sudo systemctl stop proxy.service # service update ############################################################ -sudo cat > /lib/systemd/system/http.server-fdmr2.service <<- "EOFH" -[Unit] -Description=PHP http.server.fdmr2 -After=network.target - -[Service] -#User=root -#ExecStartPre=/bin/sleep 30 -# Modify for different other port -ExecStart=php -S 0.0.0.0:80 -t /var/www/fdmr2/ -Restart=on-failure - -[Install] -WantedBy=multi-user.target -EOFH - cd / if [ -d "/var/www/fdmr2" ] then @@ -1348,12 +1305,6 @@ python3 mon_db.py --update ##################################### - -sudo systemctl disable http.server-fdmr.service -if ! systemctl status http.server-fdmr2.service | grep "service; enabled;" >/dev/null 2>&1; then - sudo systemctl enable http.server-fdmr2.service - -fi sudo systemctl disable fdmr_mon.service if ! systemctl status fdmr_mon2.service | grep "service; enabled;" >/dev/null 2>&1; then sudo systemctl enable fdmr_mon2.service @@ -1368,13 +1319,10 @@ if [ -z "$variable1" ] then variable1=80 fi -sudo sed -i "s/ExecStart=.*/ExecStart=php -S 0.0.0.0:$variable1 -t \/var\/www\/fdmr\//g" /lib/systemd/system/http.server-fdmr.service -sudo sed -i "s/ExecStart=.*/ExecStart=php -S 0.0.0.0:$variable1 -t \/var\/www\/fdmr2\//g" /lib/systemd/system/http.server-fdmr2.service systemctl daemon-reload && systemctl start fdmr_mon2.service systemctl start proxy.service - systemctl start http.server-fdmr2.service sh /opt/extra-3.sh (crontab -l; echo "* */1 * * * sync ; echo 3 > /proc/sys/vm/drop_caches >/dev/null 2>&1")|awk '!x[$0]++'|crontab -