Update menu-fdmr

This commit is contained in:
Esteban Mackay Q. 2024-05-20 20:19:15 -05:00
parent 1c6c864181
commit c7d329427a
1 changed files with 32 additions and 27 deletions

View File

@ -1,11 +1,11 @@
#!/bin/bash
if ! grep -q "Web-Dashboar-name" "/opt/wdp" > /dev/null 2>&1; then
cat > /opt/wdp <<- "EOFX"
#########################################
# Select number port, FreeDMR Dashboard #
#########################################
############################################
# Select number port, ADN-Server Dashboard #
############################################
Web-Dashboar-name: freedmr
Web-Dashboar-name: adn
Web-Dashboar-Port: 80
Web-Dashboar-dns:
Web-Dashboar-dir: /var/www/fdmr2
@ -14,7 +14,10 @@ Web-Dashboar-soft: /opt/FDMR-Monitor2
EOFX
fi
sudo cat > /bin/menu-fdmr <<- "EOF"
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
sudo cat > /bin/menu-adn <<- "EOF"
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
@ -23,11 +26,11 @@ if [[ $EUID -ne 0 ]]; then
fi
while : ; do
choix=$(whiptail --title "Raspbian Proyect HP3ICC FDMR+" --menu "move up or down with the keyboard arrows and select your option by pressing enter:" 23 56 13 \
1 " Edit FreeDMR Server " \
2 " Edit FDMR-Monitor " \
3 " Start-Restart FreeDMR Server " \
4 " Stop FreeDMR SERVER " \
choix=$(whiptail --title "ADN Server" --menu "move up or down with the keyboard arrows and select your option by pressing enter:" 23 56 13 \
1 " Edit ADN-Server " \
2 " Edit Monitor " \
3 " Start-Restart SERVER " \
4 " Stop SERVER " \
5 " Select Dashboard " \
6 " Stop Dashboard " \
7 " D-APRS " \
@ -43,11 +46,11 @@ while : ; do
case $choix in
1)
sudo nano /opt/FreeDMR/config/FreeDMR.cfg &&
if sudo systemctl status freedmr.service | grep "service; enabled;" >/dev/null 2>&1
sudo nano /opt/ADN-DMR-Peer-Server/config/adn.cfg &&
if sudo systemctl status adn-server.service | grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl stop freedmr.service
sudo systemctl start freedmr.service
sudo systemctl stop adn-server.service
sudo systemctl start adn-server.service
fi
if sudo systemctl status fdmr_mon.service |grep "service; enabled;" >/dev/null 2>&1
then
@ -61,7 +64,7 @@ while : ; do
fi
;;
2)
network=$(whiptail --title "Easy FreeDMR Server" --menu "Select a option:" 10 60 3 \
network=$(whiptail --title "Easy ADN Server" --menu "Select a option:" 10 60 3 \
"1" "Edit FDMR-Monitor OA4DOA" \
"2" "Edit FDMR-Monitor CS8ABG" \
"3" "Edit Web Port & dns" 3>&1 1>&2 2>&3)
@ -225,9 +228,9 @@ rm $sofd0/data/*
esac
;;
3)
sudo systemctl stop fdmrparrot.service
sudo systemctl stop adn-parrot.service
sudo systemctl stop proxy.service
sudo systemctl stop freedmr.service
sudo systemctl stop adn-server.service
if ! systemctl status mariadb.service | grep "Active: active" >/dev/null 2>&1
then
sudo systemctl stop mariadb.service
@ -247,25 +250,25 @@ rm $sofd0/data/*
sudo systemctl stop fdmr_mon2.service
sudo systemctl start fdmr_mon2.service
fi
sudo systemctl start freedmr.service
sudo systemctl start fdmrparrot.service
sudo systemctl start adn-server.service
sudo systemctl start adn-parrot.service
sudo systemctl start proxy.service
sudo systemctl enable fdmrparrot.service
sudo systemctl enable adn-parrot.service
sudo systemctl enable proxy.service
sudo systemctl enable freedmr.service
sudo systemctl enable adn-server.service
;;
4)
sudo systemctl stop fdmrparrot.service
sudo systemctl disable fdmrparrot.service
sudo systemctl stop adn-parrot.service
sudo systemctl disable adn-parrot.service
sudo systemctl stop proxy.service
sudo systemctl disable proxy.service
sudo systemctl stop freedmr.service
sudo systemctl disable freedmr.service
sudo systemctl stop adn-server.service
sudo systemctl disable adn-server.service
if systemctl is-enabled mariadb.service | grep -q "disabled"; then
echo "El servicio mariadb está deshabilitado."
else
if systemctl is-enabled freedmr.service | grep -q "enabled"; then
if systemctl is-enabled adn-server.service | grep -q "enabled"; then
echo "El servicio freedmr está habilitado."
else
if [ -e "/etc/nginx/sites-enabled/freedmr" ]; then
@ -420,7 +423,7 @@ rm $sofd0/data/*
if systemctl is-enabled mariadb.service | grep -q "disabled"; then
echo "El servicio mariadb está deshabilitado."
else
if systemctl is-enabled freedmr.service | grep -q "enabled"; then
if systemctl is-enabled adn-server.service | grep -q "enabled"; then
echo "El servicio freedmr está habilitado."
else
if systemctl is-enabled fdmr_mon.service | grep -q "enabled"; then
@ -450,5 +453,7 @@ exit 0
EOF
################
sudo chmod +x /bin/menu*
ln -sf /bin/menu-adn /bin/MENU-ADN
ln -sf /bin/menu-adn /bin/menu-fdmr
ln -sf /bin/menu-fdmr /bin/MENU-FDMR
chmod +x /bin/MENU*