This commit is contained in:
Esteban Mackay Q 2023-08-28 22:53:53 -05:00
parent 96f0f24bf3
commit 780a333779
9 changed files with 571 additions and 207 deletions

View File

@ -376,7 +376,19 @@ EOF
######################################################################################################################### #########################################################################################################################
# direwolf - dashboard # direwolf - dashboard
######################################################################################################################### #########################################################################################################################
if [ -f "/opt/wdp2" ]
then
echo "found file"
else
cat > /opt/wdp2 <<- "EOFX"
##########################################
# Select number port, Direwolf Dashboard #
##########################################
Web-Dashboar-Port: 80
EOFX
fi
cd /opt cd /opt
git clone https://github.com/IZ7BOJ/direwolf_webstat.git git clone https://github.com/IZ7BOJ/direwolf_webstat.git
#cd /opt/direwolf_webstat #cd /opt/direwolf_webstat

View File

@ -101,6 +101,19 @@ esac
EOF EOF
### ###
if [ -f "/opt/wdp3" ]
then
echo "found file"
else
cat > /opt/wdp3 <<- "EOFX"
##########################################
# Select number port, DVSwitch Dashboard #
##########################################
Web-Dashboar-Port: 80
EOFX
fi
cd /tmp/ cd /tmp/
wget https://gitlab.com/hp3icc/DVSwitch-Mobile-TG-List/-/raw/main/lang.sh wget https://gitlab.com/hp3icc/DVSwitch-Mobile-TG-List/-/raw/main/lang.sh
sudo chmod +x lang.sh sudo chmod +x lang.sh

View File

@ -519,6 +519,19 @@ EOF
# MMDVMHost - Dashboard WebSocket # MMDVMHost - Dashboard WebSocket
################################################################################################################################# #################################################################################################################################
#web #web
if [ -f "/opt/wdp5" ]
then
echo "found file"
else
cat > /opt/wdp5 <<- "EOFX"
###########################################
# Select number port, MMDVMHost Dashboard #
###########################################
Web-Dashboar-Port: 80
EOFX
fi
#apps=("python3-pip" "python3-websockets" "python3-gpiozero" "python3-psutil" "python3-serial") #apps=("python3-pip" "python3-websockets" "python3-gpiozero" "python3-psutil" "python3-serial")

View File

@ -65,7 +65,19 @@ EOF
######################################################################################################################### #########################################################################################################################
# YSF-Reflector-Dashboard # YSF-Reflector-Dashboard
######################################################################################################################### #########################################################################################################################
if [ -f "/opt/wdp4" ]
then
echo "found file"
else
cat > /opt/wdp4 <<- "EOFX"
##############################################
# Select number port, YSFReflector Dashboard #
##############################################
Web-Dashboar-Port: 80
EOFX
fi
cd /opt/ cd /opt/
git clone --recurse-submodules -j8 https://github.com/dg9vh/WSYSFDash git clone --recurse-submodules -j8 https://github.com/dg9vh/WSYSFDash
cd /opt/WSYSFDash/ cd /opt/WSYSFDash/

View File

@ -85,11 +85,51 @@ rm /var/log/mmdvm/*;;
3) 3)
sudo /usr/local/dvs/dvs ;; sudo /usr/local/dvs/dvs ;;
4) 4)
nano /lib/systemd/system/http.server-dvs.service && sudo systemctl daemon-reload ;; if sudo systemctl status http.server-dvs.service |grep active >/dev/null 2>&1
then
sudo systemctl stop http.server-dvs.service
fi
nano /opt/wdp3 &&
variable80=$(grep "Web-Dashboar-Port:" /opt/wdp3 | grep -Eo '[A.0-9]{1,9}')
if [ -z "$variable80" ]
then variable80=80
fi
sudo sed -i "s/ExecStart=.*/ExecStart=php -S 0.0.0.0:$variable80 -t \/var\/www\/dvs\//g" /lib/systemd/system/http.server-dvs.service &&
systemctl daemon-reload &&
if sudo netstat -tuln | grep -q "0.0.0.0:$variable80"; then
whiptail --title "Check Port" --msgbox "El puerto $variable80 esta ocupado , The port $variable80 is busy" 0 50
else
if sudo systemctl status http.server-dvs.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl start http.server-dvs.service
fi
fi ;;
5) 5)
sudo systemctl stop http.server-dvs.service if sudo systemctl status http.server-dvs.service |grep "service; enabled;" >/dev/null 2>&1
sudo systemctl start http.server-dvs.service then
sudo systemctl enable http.server-dvs.service ;; sudo systemctl disable http.server-dvs.service
fi
if sudo systemctl status http.server-dvs.service |grep active >/dev/null 2>&1
then
sudo systemctl stop http.server-dvs.service
fi
variable80=$(grep "Web-Dashboar-Port:" /opt/wdp3 | grep -Eo '[A.0-9]{1,9}')
if [ -z "$variable80" ]
then variable80=80
fi
sudo sed -i "s/ExecStart=.*/ExecStart=php -S 0.0.0.0:$variable80 -t \/var\/www\/dvs\//g" /lib/systemd/system/http.server-dvs.service &&
systemctl daemon-reload &&
if sudo netstat -tuln | grep -q "0.0.0.0:$variable80"; then
whiptail --title "Check Port" --msgbox "El puerto $variable80 esta ocupado , The port $variable80 is busy" 0 50
else
if ! sudo systemctl status http.server-dvs.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl enable http.server-dvs.service
fi
sudo systemctl start http.server-dvs.service
fi ;;
6) 6)
sudo systemctl stop http.server-dvs.service && sudo systemctl disable http.server-dvs.service ;; sudo systemctl stop http.server-dvs.service && sudo systemctl disable http.server-dvs.service ;;
7) 7)

View File

@ -9,7 +9,7 @@ choix=$(whiptail --title "Raspbian Proyect HP3ICC Menu Direwolf" --menu "Suba o
3 " Edit Frecuency SDR-RTL " \ 3 " Edit Frecuency SDR-RTL " \
4 " Edit Direwolf Tracker " \ 4 " Edit Direwolf Tracker " \
5 " Edit Dashboard " \ 5 " Edit Dashboard " \
6 " Edit port http Dashbord " \ 6 " Select Web Dashboard Port " \
7 " Start Direwolf SDR-RTL" \ 7 " Start Direwolf SDR-RTL" \
8 " Start Direwolf Tracker" \ 8 " Start Direwolf Tracker" \
9 " Start Direwolf Analogo" \ 9 " Start Direwolf Analogo" \
@ -38,10 +38,25 @@ sudo nano /opt/direwolf/gpsd.conf;;
5) 5)
sudo nano /opt/direwolf_webstat/config.php;; sudo nano /opt/direwolf_webstat/config.php;;
6) 6)
sudo nano /lib/systemd/system/http.server-dw.service && sudo systemctl daemon-reload && if sudo systemctl status http.server-dw.service |grep active >/dev/null 2>&1
if systemctl status http.server-dw.service |grep running >/dev/null 2>&1
then then
sudo systemctl restart http.server-dw.service sudo systemctl stop http.server-dw.service
fi
nano /opt/wdp2 &&
variable80=$(grep "Web-Dashboar-Port:" /opt/wdp2 | grep -Eo '[A.0-9]{1,9}')
if [ -z "$variable80" ]
then variable80=80
fi
sudo sed -i "s/ExecStart=.*/ExecStart=php -S 0.0.0.0:$variable80 -t \/opt\/direwolf_webstat\//g" /lib/systemd/system/http.server-dw.service &&
systemctl daemon-reload &&
if sudo netstat -tuln | grep -q "0.0.0.0:$variable80"; then
whiptail --title "Check Port" --msgbox "El puerto $variable80 esta ocupado , The port $variable80 is busy" 0 50
else
if sudo systemctl status http.server-dw.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl start http.server-dw.service
fi
fi ;; fi ;;
7) 7)
sudo systemctl stop direwolf.service sudo systemctl stop direwolf.service
@ -111,40 +126,91 @@ fi
sudo systemctl start direwolf.service sudo systemctl start direwolf.service
sudo systemctl enable direwolf.service ;; sudo systemctl enable direwolf.service ;;
10) 10)
sudo systemctl stop direwolf.service if systemctl status http.server-dw.service |grep "service; enabled;" >/dev/null 2>&1
sudo systemctl stop http.server-dw.service then sudo systemctl disable http.server-dw.service
if [ "$(cat /proc/cpuinfo | grep 'Zero')" != "" ]; then
fi
if sudo systemctl status http.server-dw.service |grep active >/dev/null 2>&1
then
sudo systemctl stop http.server-dw.service
fi
if systemctl status direwolf.service |grep "service; enabled;" >/dev/null 2>&1
then sudo systemctl disable direwolf.service
fi
if sudo systemctl status direwolf.service |grep active >/dev/null 2>&1
then
sudo systemctl stop direwolf.service
fi
variable80=$(grep "Web-Dashboar-Port:" /opt/wdp2 | grep -Eo '[A.0-9]{1,9}')
if [ -z "$variable80" ]
then variable80=80
fi
sudo sed -i "s/ExecStart=.*/ExecStart=php -S 0.0.0.0:$variable80 -t \/opt\/direwolf_webstat\//g" /lib/systemd/system/http.server-dw.service &&
systemctl daemon-reload &&
if sudo netstat -tuln | grep -q "0.0.0.0:$variable80"; then
whiptail --title "Check Port" --msgbox "El puerto $variable80 esta ocupado , The port $variable80 is busy" 0 50
else
if [ "$(cat /proc/cpuinfo | grep 'Zero')" != "" ]; then
sudo cp /opt/direwolf/direwolf1 /usr/local/bin/direwolf sudo cp /opt/direwolf/direwolf1 /usr/local/bin/direwolf
sudo chmod +x /usr/local/bin/direwolf sudo chmod +x /usr/local/bin/direwolf
else else
sudo cp /opt/direwolf/direwolf2 /usr/local/bin/direwolf sudo cp /opt/direwolf/direwolf2 /usr/local/bin/direwolf
sudo chmod +x /usr/local/bin/direwolf sudo chmod +x /usr/local/bin/direwolf
fi fi
sudo sed -i "s/ExecStart=.*/ExecStart=\/usr\/local\/bin\/direwolf -t 0 -l \/var\/log\/direwolf -c \/opt\/direwolf\/dw.conf/" /lib/systemd/system/direwolf.service sudo sed -i "s/ExecStart=.*/ExecStart=\/usr\/local\/bin\/direwolf -t 0 -l \/var\/log\/direwolf -c \/opt\/direwolf\/dw.conf/" /lib/systemd/system/direwolf.service
sudo systemctl daemon-reload sudo systemctl daemon-reload
sudo systemctl start direwolf.service sudo systemctl start direwolf.service
sudo systemctl start http.server-dw.service sudo systemctl start http.server-dw.service
sudo systemctl enable http.server-dw.service sudo systemctl enable http.server-dw.service
sudo systemctl enable direwolf.service ;; sudo systemctl enable direwolf.service
fi ;;
11) 11)
sudo systemctl stop direwolf.service if systemctl status http.server-dw.service |grep "service; enabled;" >/dev/null 2>&1
sudo systemctl stop http.server-dw.service then sudo systemctl disable http.server-dw.service
if [ "$(cat /proc/cpuinfo | grep 'Zero')" != "" ]; then
sudo cp /opt/direwolf/direwolf1 /usr/local/bin/direwolf
sudo chmod +x /usr/local/bin/direwolf
else
sudo cp /opt/direwolf/direwolf2 /usr/local/bin/direwolf
sudo chmod +x /usr/local/bin/direwolf
fi fi
if sudo systemctl status http.server-dw.service |grep active >/dev/null 2>&1
then
sudo systemctl stop http.server-dw.service
fi
if systemctl status direwolf.service |grep "service; enabled;" >/dev/null 2>&1
then sudo systemctl disable direwolf.service
fi
if sudo systemctl status direwolf.service |grep active >/dev/null 2>&1
then
sudo systemctl stop direwolf.service
fi
variable80=$(grep "Web-Dashboar-Port:" /opt/wdp2 | grep -Eo '[A.0-9]{1,9}')
if [ -z "$variable80" ]
then variable80=80
fi
sudo sed -i "s/ExecStart=.*/ExecStart=php -S 0.0.0.0:$variable80 -t \/opt\/direwolf_webstat\//g" /lib/systemd/system/http.server-dw.service &&
systemctl daemon-reload &&
if sudo netstat -tuln | grep -q "0.0.0.0:$variable80"; then
whiptail --title "Check Port" --msgbox "El puerto $variable80 esta ocupado , The port $variable80 is busy" 0 50
else
sudo systemctl stop direwolf.service
if [ "$(cat /proc/cpuinfo | grep 'Zero')" != "" ]; then
sudo cp /opt/direwolf/direwolf1 /usr/local/bin/direwolf
sudo chmod +x /usr/local/bin/direwolf
else
sudo cp /opt/direwolf/direwolf2 /usr/local/bin/direwolf
sudo chmod +x /usr/local/bin/direwolf
fi
sudo sed -i "s/#-l \/var\/log\/direwolf/ -l \/var\/log\/direwolf/" /opt/direwolf/rtl.sh sudo sed -i "s/#-l \/var\/log\/direwolf/ -l \/var\/log\/direwolf/" /opt/direwolf/rtl.sh
sudo sed -i "s/ExecStart=.*/ExecStart=\/bin\/sh \/opt\/direwolf\/rtl.sh/" /lib/systemd/system/direwolf.service sudo sed -i "s/ExecStart=.*/ExecStart=\/bin\/sh \/opt\/direwolf\/rtl.sh/" /lib/systemd/system/direwolf.service
sudo systemctl daemon-reload sudo systemctl daemon-reload
sudo systemctl start direwolf.service sudo systemctl start direwolf.service
sudo systemctl start http.server-dw.service sudo systemctl start http.server-dw.service
sudo systemctl enable http.server-dw.service sudo systemctl enable http.server-dw.service
sudo systemctl enable direwolf.service ;; sudo systemctl enable direwolf.service
fi ;;
12) 12)
if systemctl status http.server-dw.service | grep enable >/dev/null 2>&1 if systemctl status http.server-dw.service | grep enable >/dev/null 2>&1
then then

View File

@ -30,9 +30,17 @@ fi
# case : action en fonction du choix # case : action en fonction du choix
case $choix in case $choix in
1) 1)
sudo nano /opt/FreeDMR/config/FreeDMR.cfg ;; sudo nano /opt/FreeDMR/config/FreeDMR.cfg &&
if sudo systemctl status freedmr.server-fdmr.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl restart freedmr.service
fi;;
2) 2)
sudo nano /opt/FreeDMR/config/rules.py ;; sudo nano /opt/FreeDMR/config/rules.py &&
if sudo systemctl status freedmr.server-fdmr.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl restart freedmr.service
fi ;;
3) 3)
sudo nano /opt/FDMR-Monitor/fdmr-mon.cfg ;; sudo nano /opt/FDMR-Monitor/fdmr-mon.cfg ;;
4) 4)
@ -47,41 +55,34 @@ if sudo systemctl status http.server-fdmr2.service |grep active >/dev/null 2>&1
then then
sudo systemctl stop http.server-fdmr2.service sudo systemctl stop http.server-fdmr2.service
fi && fi &&
variable1=$(grep "Web-Dashboar-Port:" /opt/wdp | grep -Eo '[A.0-9]{1,9}') && variable80=$(grep "Web-Dashboar-Port:" /opt/wdp | grep -Eo '[A.0-9]{1,9}')
if [ -z "$variable1" ] if [ -z "$variable80" ]
then variable1=80 then variable80=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 &&
if sudo systemctl status http.server-fdmr.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl start http.server-fdmr.service
fi fi
if sudo systemctl status http.server-fdmr2.service |grep "service; enabled;" >/dev/null 2>&1 sudo sed -i "s/ExecStart=.*/ExecStart=php -S 0.0.0.0:$variable80 -t \/var\/www\/fdmr\//g" /lib/systemd/system/http.server-fdmr.service &&
then sudo sed -i "s/ExecStart=.*/ExecStart=php -S 0.0.0.0:$variable80 -t \/var\/www\/fdmr2\//g" /lib/systemd/system/http.server-fdmr2.service &&
sudo systemctl start http.server-fdmr2.service systemctl daemon-reload &&
if sudo netstat -tuln | grep -q "0.0.0.0:$variable80"; then
whiptail --title "Check Port" --msgbox "El puerto $variable80 esta ocupado , The port $variable80 is busy" 0 50
else
if sudo systemctl status http.server-fdmr.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl start http.server-fdmr.service
else
if sudo systemctl status http.server-fdmr2.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl start http.server-fdmr2.service
fi
fi
fi ;; fi ;;
6) 6)
if systemctl status mariadb.service |grep inactive >/dev/null 2>&1 if ! systemctl status mariadb.service |grep "Active: active" >/dev/null 2>&1
then sudo systemctl start mariadb.service then sudo systemctl restart mariadb.service
fi fi
if systemctl status mariadb.service |grep disable >/dev/null 2>&1 if ! systemctl status mariadb.service |grep "service; enabled;" >/dev/null 2>&1
then sudo systemctl enable mariadb.service then sudo systemctl enable mariadb.service
fi
if systemctl status fdmrparrot.service |grep active >/dev/null 2>&1
then sudo systemctl stop fdmrparrot.service
fi
if systemctl status proxy.service |grep active >/dev/null 2>&1
then sudo systemctl stop proxy.service
fi
if systemctl status freedmr.service |grep active >/dev/null 2>&1
then sudo systemctl stop freedmr.service
fi fi
if systemctl status fdmrparrot.service |grep disable >/dev/null 2>&1 if systemctl status fdmrparrot.service |grep disable >/dev/null 2>&1
@ -95,6 +96,18 @@ fi
if systemctl status freedmr.service |grep disable >/dev/null 2>&1 if systemctl status freedmr.service |grep disable >/dev/null 2>&1
then sudo systemctl enable freedmr.service then sudo systemctl enable freedmr.service
fi
if systemctl status fdmrparrot.service |grep active >/dev/null 2>&1
then sudo systemctl stop fdmrparrot.service
fi
if systemctl status proxy.service |grep active >/dev/null 2>&1
then sudo systemctl stop proxy.service
fi
if systemctl status freedmr.service |grep active >/dev/null 2>&1
then sudo systemctl stop freedmr.service
fi fi
sudo systemctl start freedmr.service sudo systemctl start freedmr.service
sudo systemctl start fdmrparrot.service sudo systemctl start fdmrparrot.service
@ -109,21 +122,21 @@ sudo systemctl disable freedmr.service
# Verificar el estado del servicio mariadb.service # Verificar el estado del servicio mariadb.service
if systemctl is-enabled mariadb.service | grep -q "disabled"; then if systemctl is-enabled mariadb.service | grep -q "disabled"; then
echo "El servicio mariadb está deshabilitado." echo "El servicio mariadb esta deshabilitado."
else else
# Verificar el estado del servicio freedmr-fdmr.service # Verificar el estado del servicio freedmr-fdmr.service
if systemctl is-enabled freedmr.service | grep -q "enabled"; then if systemctl is-enabled freedmr.service | grep -q "enabled"; then
echo "El servicio freedmr está habilitado." echo "El servicio freedmr esta habilitado."
else else
# Verificar el estado del servicio http.server-fdmr.service # Verificar el estado del servicio http.server-fdmr.service
if systemctl is-enabled http.server-fdmr.service | grep -q "enabled"; then if systemctl is-enabled http.server-fdmr.service | grep -q "enabled"; then
echo "El servicio http.server-fdmr está habilitado." echo "El servicio http.server-fdmr esta habilitado."
else else
# Verificar el estado del servicio http.server-fdmr2.service # Verificar el estado del servicio http.server-fdmr2.service
if systemctl is-enabled http.server-fdmr2.service | grep -q "enabled"; then if systemctl is-enabled http.server-fdmr2.service | grep -q "enabled"; then
echo "El servicio http.server-fdmr2 está habilitado." echo "El servicio http.server-fdmr2 está habilitado."
else else
# Si todo está bien, deshabilitar el servicio mariadb.service # Si todo esta bien, deshabilitar el servicio mariadb.service
systemctl disable mariadb.service systemctl disable mariadb.service
systemctl stop mariadb.service systemctl stop mariadb.service
echo "El servicio mariadb ha sido deshabilitado." echo "El servicio mariadb ha sido deshabilitado."
@ -133,151 +146,173 @@ else
fi fi
;; ;;
8) 8)
(crontab -l; echo "* */1 * * * sync ; echo 3 > /proc/sys/vm/drop_caches >/dev/null 2>&1")|awk '!x[$0]++'|crontab - if systemctl status http.server-fdmr.service |grep "service; enabled;" >/dev/null 2>&1
(crontab -l; echo "* */24 * * * rm /opt/FDMR-Monitor/data/*")|awk '!x[$0]++'|crontab - then sudo systemctl disable http.server-fdmr.service
(crontab -l; echo "*/2 * * * * sh /opt/FDMR-Monitor/sysinfo/cpu.sh")|awk '!x[$0]++'|crontab -
(crontab -l; echo "*/5 * * * * sh /opt/FDMR-Monitor/sysinfo/graph.sh")|awk '!x[$0]++'|crontab -
(crontab -l | grep -v "sh /etc/freedmr/hbmon/sysinfo/cpu.sh") | crontab -
(crontab -l | grep -v "sh /etc/freedmr/hbmon/sysinfo/graph.sh") | crontab -
(crontab -l | grep -v "rm /etc/freedmr/hbmon/data/*") | crontab -
(crontab -l | grep -v "rm /opt/FDMR-Monitor2/data/*") | crontab -
if systemctl status mariadb.service |grep inactive >/dev/null 2>&1
then sudo systemctl start mariadb.service
fi
if systemctl status mariadb.service |grep disable >/dev/null 2>&1
then sudo systemctl enable mariadb.service
fi fi
if systemctl status http.server-fdmr2.service |grep "service; enabled;" >/dev/null 2>&1 if systemctl status http.server-fdmr2.service |grep "service; enabled;" >/dev/null 2>&1
then sudo systemctl disable http.server-fdmr2.service then sudo systemctl disable http.server-fdmr2.service
fi fi
if ! systemctl status http.server-fdmr.service | grep "service; enabled;" >/dev/null 2>&1; then if systemctl status fdmr_mon.service |grep "service; enabled;" >/dev/null 2>&1
sudo systemctl enable http.server-fdmr.service then sudo systemctl disable fdmr_mon.service
fi fi
if systemctl status fdmr_mon2.service |grep "service; enabled;" >/dev/null 2>&1 if systemctl status fdmr_mon2.service |grep "service; enabled;" >/dev/null 2>&1
then sudo systemctl disable fdmr_mon2.service then sudo systemctl disable fdmr_mon2.service
fi fi
if ! systemctl status fdmr_mon.service | grep "service; enabled;" >/dev/null 2>&1; then
sudo systemctl enable fdmr_mon.service
fi
if ! systemctl status proxy.service | grep "service; enabled;" >/dev/null 2>&1; then
sudo systemctl enable proxy.service
fi
#####################################
if sudo systemctl status http.server-fdmr.service |grep active >/dev/null 2>&1 if sudo systemctl status http.server-fdmr.service |grep active >/dev/null 2>&1
then then
sudo systemctl stop http.server-fdmr.service sudo systemctl stop http.server-fdmr.service
fi && fi
if sudo systemctl status http.server-fdmr2.service |grep active >/dev/null 2>&1 if sudo systemctl status http.server-fdmr2.service |grep active >/dev/null 2>&1
then then
sudo systemctl stop http.server-fdmr2.service sudo systemctl stop http.server-fdmr2.service
fi && fi
variable1=$(grep "Web-Dashboar-Port:" /opt/wdp | grep -Eo '[A.0-9]{1,9}') && if sudo systemctl status fdmr_mon.service |grep active >/dev/null 2>&1
if [ -z "$variable1" ] then
then variable1=80 sudo systemctl stop fdmr_mon.service
fi
if sudo systemctl status fdmr_mon2.service |grep active >/dev/null 2>&1
then
sudo systemctl stop fdmr_mon2.service
fi
variable80=$(grep "Web-Dashboar-Port:" /opt/wdp | grep -Eo '[A.0-9]{1,9}')
if [ -z "$variable80" ]
then variable80=80
fi && 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:$variable80 -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 && sudo sed -i "s/ExecStart=.*/ExecStart=php -S 0.0.0.0:$variable80 -t \/var\/www\/fdmr2\//g" /lib/systemd/system/http.server-fdmr2.service &&
systemctl daemon-reload && systemctl daemon-reload &&
if systemctl status fdmr_mon2.service |grep active >/dev/null 2>&1 if sudo netstat -tuln | grep -q "0.0.0.0:$variable80"; then
then sudo systemctl stop fdmr_mon2.service whiptail --title "Check Port" --msgbox "El puerto $variable80 esta ocupado , The port $variable80 is busy" 0 50
else
(crontab -l; echo "* */1 * * * sync ; echo 3 > /proc/sys/vm/drop_caches >/dev/null 2>&1")|awk '!x[$0]++'|crontab -
(crontab -l; echo "* */24 * * * rm /opt/FDMR-Monitor/data/*")|awk '!x[$0]++'|crontab -
(crontab -l; echo "*/2 * * * * sh /opt/FDMR-Monitor/sysinfo/cpu.sh")|awk '!x[$0]++'|crontab -
(crontab -l; echo "*/5 * * * * sh /opt/FDMR-Monitor/sysinfo/graph.sh")|awk '!x[$0]++'|crontab -
(crontab -l | grep -v "sh /etc/freedmr/hbmon/sysinfo/cpu.sh") | crontab -
(crontab -l | grep -v "sh /etc/freedmr/hbmon/sysinfo/graph.sh") | crontab -
(crontab -l | grep -v "rm /etc/freedmr/hbmon/data/*") | crontab -
(crontab -l | grep -v "rm /opt/FDMR-Monitor2/data/*") | crontab -
if ! systemctl status mariadb.service |grep "Active: active" >/dev/null 2>&1
then sudo systemctl restart mariadb.service
fi fi
if systemctl status fdmr_mon.service |grep active >/dev/null 2>&1 if ! systemctl status mariadb.service |grep "service; enabled;" >/dev/null 2>&1
then sudo systemctl stop fdmr_mon.service then sudo systemctl enable mariadb.service
fi fi
rm /opt/FDMR-Monitor/data/* if ! systemctl status proxy.service | grep "service; enabled;" >/dev/null 2>&1; then
mysql -u root -e "DROP TABLE IF EXISTS selfcare.last_heard;" && sudo systemctl enable proxy.service
mysql -u root -e "DROP TABLE IF EXISTS selfcare.lstheard_log;" &&
mysql -u root -e "DROP TABLE IF EXISTS selfcare.peer_ids;" && fi
mysql -u root -e "DROP TABLE IF EXISTS selfcare.subscriber_ids;" && if ! systemctl status proxy.service | grep "Active: active" >/dev/null 2>&1; then
mysql -u root -e "DROP TABLE IF EXISTS selfcare.talkgroup_ids;" && sudo systemctl restart proxy.service
mysql -u root -e "DROP TABLE IF EXISTS selfcare.tg_count;"
cd /opt/FDMR-Monitor fi
python3 mon_db.py --create && #####################################
python3 mon_db.py --update rm /opt/FDMR-Monitor/data/*
sudo systemctl start fdmr_mon.service mysql -u root -e "DROP TABLE IF EXISTS selfcare.last_heard;" &&
sudo systemctl start http.server-fdmr.service ;; mysql -u root -e "DROP TABLE IF EXISTS selfcare.lstheard_log;" &&
mysql -u root -e "DROP TABLE IF EXISTS selfcare.peer_ids;" &&
mysql -u root -e "DROP TABLE IF EXISTS selfcare.subscriber_ids;" &&
mysql -u root -e "DROP TABLE IF EXISTS selfcare.talkgroup_ids;" &&
mysql -u root -e "DROP TABLE IF EXISTS selfcare.tg_count;"
cd /opt/FDMR-Monitor
python3 mon_db.py --create &&
python3 mon_db.py --update
sudo systemctl start fdmr_mon.service
sudo systemctl enable fdmr_mon.service
sudo systemctl start http.server-fdmr.service
sudo systemctl enable http.server-fdmr.service
fi ;;
9) 9)
(crontab -l; echo "* */1 * * * sync ; echo 3 > /proc/sys/vm/drop_caches >/dev/null 2>&1")|awk '!x[$0]++'|crontab -
(crontab -l; echo "* */24 * * * rm /opt/FDMR-Monitor2/data/*")|awk '!x[$0]++'|crontab -
(crontab -l | grep -v "rm /opt/FDMR-Monitor/data/*") | crontab -
(crontab -l | grep -v "rm /etc/freedmr/hbmon/data/*") | crontab -
(crontab -l | grep -v "sh /etc/freedmr/hbmon/sysinfo/cpu.sh") | crontab -
(crontab -l | grep -v "sh /etc/freedmr/hbmon/sysinfo/graph.sh") | crontab -
(crontab -l | grep -v "sh /opt/FDMR-Monitor/sysinfo/cpu.sh") | crontab -
(crontab -l | grep -v "sh /opt/FDMR-Monitor/sysinfo/graph.sh") | crontab -
if systemctl status mariadb.service |grep inactive >/dev/null 2>&1
then sudo systemctl start mariadb.service
fi
if systemctl status mariadb.service |grep disable >/dev/null 2>&1
then sudo systemctl enable mariadb.service
fi
if systemctl status http.server-fdmr.service |grep "service; enabled;" >/dev/null 2>&1 if systemctl status http.server-fdmr.service |grep "service; enabled;" >/dev/null 2>&1
then sudo systemctl disable http.server-fdmr.service then sudo systemctl disable http.server-fdmr.service
fi fi
if ! systemctl status http.server-fdmr2.service | grep "service; enabled;" >/dev/null 2>&1; then if systemctl status http.server-fdmr2.service |grep "service; enabled;" >/dev/null 2>&1
sudo systemctl enable http.server-fdmr2.service then sudo systemctl disable http.server-fdmr2.service
fi fi
if systemctl status fdmr_mon.service |grep "service; enabled;" >/dev/null 2>&1 if systemctl status fdmr_mon.service |grep "service; enabled;" >/dev/null 2>&1
then sudo systemctl disable fdmr_mon.service then sudo systemctl disable fdmr_mon.service
fi fi
if ! systemctl status fdmr_mon2.service | grep "service; enabled;" >/dev/null 2>&1; then if systemctl status fdmr_mon2.service |grep "service; enabled;" >/dev/null 2>&1
sudo systemctl enable fdmr_mon2.service then sudo systemctl disable fdmr_mon2.service
fi
if ! systemctl status proxy.service | grep "service; enabled;" >/dev/null 2>&1; then
sudo systemctl enable proxy.service
fi fi
#####################################
if sudo systemctl status http.server-fdmr.service |grep active >/dev/null 2>&1 if sudo systemctl status http.server-fdmr.service |grep active >/dev/null 2>&1
then then
sudo systemctl stop http.server-fdmr.service sudo systemctl stop http.server-fdmr.service
fi && fi
if sudo systemctl status http.server-fdmr2.service |grep active >/dev/null 2>&1 if sudo systemctl status http.server-fdmr2.service |grep active >/dev/null 2>&1
then then
sudo systemctl stop http.server-fdmr2.service sudo systemctl stop http.server-fdmr2.service
fi && fi
variable1=$(grep "Web-Dashboar-Port:" /opt/wdp | grep -Eo '[A.0-9]{1,9}') && if sudo systemctl status fdmr_mon.service |grep active >/dev/null 2>&1
if [ -z "$variable1" ] then
then variable1=80 sudo systemctl stop fdmr_mon.service
fi
if sudo systemctl status fdmr_mon2.service |grep active >/dev/null 2>&1
then
sudo systemctl stop fdmr_mon2.service
fi
variable80=$(grep "Web-Dashboar-Port:" /opt/wdp | grep -Eo '[A.0-9]{1,9}')
if [ -z "$variable80" ]
then variable80=80
fi && 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:$variable80 -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 && sudo sed -i "s/ExecStart=.*/ExecStart=php -S 0.0.0.0:$variable80 -t \/var\/www\/fdmr2\//g" /lib/systemd/system/http.server-fdmr2.service &&
systemctl daemon-reload && systemctl daemon-reload &&
if systemctl status fdmr_mon.service |grep active >/dev/null 2>&1 if sudo netstat -tuln | grep -q "0.0.0.0:$variable80"; then
then sudo systemctl stop fdmr_mon.service whiptail --title "Check Port" --msgbox "El puerto $variable80 esta ocupado , The port $variable80 is busy" 0 50
else
(crontab -l; echo "* */1 * * * sync ; echo 3 > /proc/sys/vm/drop_caches >/dev/null 2>&1")|awk '!x[$0]++'|crontab -
(crontab -l; echo "* */24 * * * rm /opt/FDMR-Monitor2/data/*")|awk '!x[$0]++'|crontab -
(crontab -l | grep -v "rm /opt/FDMR-Monitor/data/*") | crontab -
(crontab -l | grep -v "rm /etc/freedmr/hbmon/data/*") | crontab -
(crontab -l | grep -v "sh /etc/freedmr/hbmon/sysinfo/cpu.sh") | crontab -
(crontab -l | grep -v "sh /etc/freedmr/hbmon/sysinfo/graph.sh") | crontab -
(crontab -l | grep -v "sh /opt/FDMR-Monitor/sysinfo/cpu.sh") | crontab -
(crontab -l | grep -v "sh /opt/FDMR-Monitor/sysinfo/graph.sh") | crontab -
if ! systemctl status mariadb.service |grep "Active: active" >/dev/null 2>&1
then sudo systemctl restart mariadb.service
fi fi
if systemctl status fdmr_mon2.service |grep active >/dev/null 2>&1 if ! systemctl status mariadb.service |grep "service; enabled;" >/dev/null 2>&1
then sudo systemctl stop fdmr_mon2.service then sudo systemctl enable mariadb.service
fi fi
rm /opt/FDMR-Monitor2/data/* if ! systemctl status proxy.service | grep "service; enabled;" >/dev/null 2>&1; then
mysql -u root -e "DROP TABLE IF EXISTS selfcare.last_heard;" && sudo systemctl enable proxy.service
mysql -u root -e "DROP TABLE IF EXISTS selfcare.lstheard_log;" &&
mysql -u root -e "DROP TABLE IF EXISTS selfcare.peer_ids;" && fi
mysql -u root -e "DROP TABLE IF EXISTS selfcare.subscriber_ids;" && if ! systemctl status proxy.service | grep "Active: active" >/dev/null 2>&1; then
mysql -u root -e "DROP TABLE IF EXISTS selfcare.talkgroup_ids;" && sudo systemctl restart proxy.service
mysql -u root -e "DROP TABLE IF EXISTS selfcare.tg_count;"
cd /opt/FDMR-Monitor2 fi
python3 mon_db.py --create && #####################################
python3 mon_db.py --update rm /opt/FDMR-Monitor2/data/*
sudo systemctl start fdmr_mon2.service mysql -u root -e "DROP TABLE IF EXISTS selfcare.last_heard;" &&
sudo systemctl start http.server-fdmr2.service ;; mysql -u root -e "DROP TABLE IF EXISTS selfcare.lstheard_log;" &&
mysql -u root -e "DROP TABLE IF EXISTS selfcare.peer_ids;" &&
mysql -u root -e "DROP TABLE IF EXISTS selfcare.subscriber_ids;" &&
mysql -u root -e "DROP TABLE IF EXISTS selfcare.talkgroup_ids;" &&
mysql -u root -e "DROP TABLE IF EXISTS selfcare.tg_count;"
cd /opt/FDMR-Monitor2
python3 mon_db.py --create &&
python3 mon_db.py --update
sudo systemctl start fdmr_mon2.service
sudo systemctl enable fdmr_mon2.service
sudo systemctl start http.server-fdmr2.service
sudo systemctl enable http.server-fdmr2.service
fi ;;
10) 10)
(crontab -l | grep -v "rm /opt/FDMR-Monitor2/data/*") | crontab - (crontab -l | grep -v "rm /opt/FDMR-Monitor2/data/*") | crontab -
(crontab -l | grep -v "rm /opt/FDMR-Monitor/data/*") | crontab - (crontab -l | grep -v "rm /opt/FDMR-Monitor/data/*") | crontab -
@ -294,21 +329,21 @@ sudo systemctl disable http.server-fdmr.service
# Verificar el estado del servicio mariadb.service # Verificar el estado del servicio mariadb.service
if systemctl is-enabled mariadb.service | grep -q "disabled"; then if systemctl is-enabled mariadb.service | grep -q "disabled"; then
echo "El servicio mariadb está deshabilitado." echo "El servicio mariadb está deshabilitado."
else else
# Verificar el estado del servicio freedmr-fdmr.service # Verificar el estado del servicio freedmr-fdmr.service
if systemctl is-enabled freedmr.service | grep -q "enabled"; then if systemctl is-enabled freedmr.service | grep -q "enabled"; then
echo "El servicio freedmr está habilitado." echo "El servicio freedmr está habilitado."
else else
# Verificar el estado del servicio http.server-fdmr.service # Verificar el estado del servicio http.server-fdmr.service
if systemctl is-enabled http.server-fdmr.service | grep -q "enabled"; then if systemctl is-enabled http.server-fdmr.service | grep -q "enabled"; then
echo "El servicio http.server-fdmr está habilitado." echo "El servicio http.server-fdmr está habilitado."
else else
# Verificar el estado del servicio http.server-fdmr2.service # Verificar el estado del servicio http.server-fdmr2.service
if systemctl is-enabled http.server-fdmr2.service | grep -q "enabled"; then if systemctl is-enabled http.server-fdmr2.service | grep -q "enabled"; then
echo "El servicio http.server-fdmr2 está habilitado." echo "El servicio http.server-fdmr2 está habilitado."
else else
# Si todo está bien, deshabilitar el servicio mariadb.service # Si todo está bien, deshabilitar el servicio mariadb.service
systemctl disable mariadb.service systemctl disable mariadb.service
systemctl stop mariadb.service systemctl stop mariadb.service
echo "El servicio mariadb ha sido deshabilitado." echo "El servicio mariadb ha sido deshabilitado."
@ -325,7 +360,6 @@ esac
done done
exit 0 exit 0
EOF EOF
################ ################
sudo chmod +x /bin/menu* sudo chmod +x /bin/menu*

View File

@ -84,27 +84,74 @@ then
fi fi
sudo systemctl stop mmdvmh.service && sudo systemctl disable mmdvmh.service && systemctl stop ysf2dmrgw.service && sudo systemctl stop dmrgw.service ;; sudo systemctl stop mmdvmh.service && sudo systemctl disable mmdvmh.service && systemctl stop ysf2dmrgw.service && sudo systemctl stop dmrgw.service ;;
7) 7)
sudo systemctl restart logtailer-mmdvmh.service && sudo systemctl enable logtailer-mmdvmh.service && sudo systemctl restart http.server-mmdvmh.service && sudo systemctl enable http.server-mmdvmh.service && cronedit.sh '* */24 * * *' 'sh /bin/tg-name.sh' add ;; if sudo systemctl status http.server-mmdvmh.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl disable http.server-mmdvmh.service
fi
if sudo systemctl status http.server-mmdvmh.service |grep active >/dev/null 2>&1
then
sudo systemctl stop http.server-mmdvmh.service
fi
if sudo systemctl status logtailer-mmdvmh.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl disable logtailer-mmdvmh.service
fi
if sudo systemctl status logtailer-mmdvmh.service |grep active >/dev/null 2>&1
then
sudo systemctl stop logtailer-mmdvmh.service
fi
variable80=$(grep "Web-Dashboar-Port:" /opt/wdp5 | grep -Eo '[A.0-9]{1,9}')
if [ -z "$variable80" ]
then variable80=80
fi
sudo sed -i "s/ExecStart=.*/ExecStart=\/usr\/bin\/python3 -m http.server $variable80 --directory \/opt\/MMDVMHost-Websocketboard\/html/g" /lib/systemd/system/http.server-mmdvmh.service &&
systemctl daemon-reload &&
if sudo netstat -tuln | grep -q "0.0.0.0:$variable80"; then
whiptail --title "Check Port" --msgbox "El puerto $variable80 esta ocupado , The port $variable80 is busy" 0 50
else
if ! sudo systemctl status http.server-mmdvmh.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl enable http.server-mmdvmh.service
fi
if ! sudo systemctl status logtailer-mmdvmh.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl enable logtailer-mmdvmh.service
fi
sudo systemctl start http.server-mmdvmh.service
sudo systemctl start logtailer-mmdvmh.service
fi ;;
8) 8)
sudo systemctl stop logtailer-mmdvmh.service && sudo systemctl disable logtailer-mmdvmh.service && sudo systemctl stop http.server-mmdvmh.service && sudo systemctl disable http.server-mmdvmh.service && cronedit.sh '* */24 * * *' 'sh /bin/tg-name.sh' remove ;; sudo systemctl stop logtailer-mmdvmh.service && sudo systemctl disable logtailer-mmdvmh.service && sudo systemctl stop http.server-mmdvmh.service && sudo systemctl disable http.server-mmdvmh.service && cronedit.sh '* */24 * * *' 'sh /bin/tg-name.sh' remove ;;
9) 9)
sudo nano /lib/systemd/system/http.server-mmdvmh.service && sudo systemctl daemon-reload ;; if sudo systemctl status http.server-mmdvmh.service |grep active >/dev/null 2>&1
then
sudo systemctl stop http.server-mmdvmh.service
fi
sudo nano /opt/wdp5 &&
variable80=$(grep "Web-Dashboar-Port:" /opt/wdp5 | grep -Eo '[A.0-9]{1,9}')
if [ -z "$variable80" ]
then variable80=80
fi
sudo sed -i "s/ExecStart=.*/ExecStart=\/usr\/bin\/python3 -m http.server $variable80 --directory \/opt\/MMDVMHost-Websocketboard\/html/g" /lib/systemd/system/http.server-mmdvmh.service &&
systemctl daemon-reload &&
if sudo netstat -tuln | grep -q "0.0.0.0:$variable80"; then
whiptail --title "Check Port" --msgbox "El puerto $variable80 esta ocupado , The port $variable80 is busy" 0 50
else
if sudo systemctl status http.server-mmdvmh.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl start http.server-mmdvmh.service
fi
fi ;;
10) 10)
sudo nano /opt/MMDVMHost-Websocketboard/html/index.html ;; sudo nano /opt/MMDVMHost-Websocketboard/html/index.html ;;
11) 11)
sudo nano /opt/MMDVMHost-Websocketboard/html/js/config.js ;; sudo nano /opt/MMDVMHost-Websocketboard/html/js/config.js ;;
12) 12)
if [ -f "/bin/tg-name.sh" ] python3 /opt/tg-name-fdmr.py ;;
then
rm /bin/tg-name.sh
fi
cat /opt/tg-name-fdmr.txt >> /bin/tg-name.sh && sh /bin/tg-name.sh ;;
13) 13)
if [ -f "/bin/tg-name.sh" ] python3 /opt/tg-name-bm.py ;;
then
rm /bin/tg-name.sh
fi
cat /opt/tg-name-bm.txt >> /bin/tg-name.sh && sh /bin/tg-name.sh ;;
14) 14)
break; break;
esac esac
@ -112,36 +159,108 @@ done
exit 0 exit 0
EOF EOF
####### #######
cat > /opt/tg-name-fdmr.txt <<- "EOF" cat > /opt/tg-name-fdmr.py <<- "EOF"
#!/bin/bash import csv
############################################################################################################### import requests
# FreeDMR List TG
############################################################################################################### # URL del archivo CSV
wget http://downloads.freedmr.uk/downloads/talkgroup_ids.csv -O /opt/MMDVMHost-Websocketboard/html/data/TG_List.csv url = "https://freedmr.cymru/talkgroups/talkgroup_ids.csv"
sed -i 's/^ */DMR,2,/' /opt/MMDVMHost-Websocketboard/html/data/TG_List.csv
sed -i 's/,/ /4' /opt/MMDVMHost-Websocketboard/html/data/TG_List.csv # Descargar el archivo CSV
echo "DMR,2,9990,Parrot TG9990" >> /opt/MMDVMHost-Websocketboard/html/data/TG_List.csv response = requests.get(url)
content = response.content.decode("utf-8")
# Leer el archivo CSV original
csv_reader = csv.reader(content.splitlines())
header = next(csv_reader) # Leer la primera fila como encabezado
# Ruta de archivo de salida
output_file_path = "/opt/MMDVMHost-Websocketboard/html/data/TG_List.csv"
# Almacenar los datos en una lista
data = []
# Procesar los datos del archivo original y agregarlos a la lista
for row in csv_reader:
data.append([int(row[0]), row[1], int(row[2])])
# Agregar la línea adicional
data.append([9, "Dial-TG TG9"])
data.append([6, "XLX TG6"])
data.append([2, "Local TG2"])
data.append([9990, "Parrot TG9990"])
# Ordenar la lista por el valor de la columna "id"
data.sort(key=lambda x: x[0])
# Abrir el archivo de salida en modo escritura
with open(output_file_path, "w", newline="") as output_file:
csv_writer = csv.writer(output_file)
# Escribir la primera fila de encabezado
csv_writer.writerow(["DMR", "2", "id", "callsign tgid"])
# Escribir los datos en el nuevo formato
for row in data:
if len(row) == 3:
csv_writer.writerow(["DMR", "2", row[0], f"{row[1]} {row[2]}"])
else:
csv_writer.writerow(["DMR", "2", row[0], row[1]])
print("Proceso completado. Archivo de salida generado en:", output_file_path)
EOF EOF
cat > /opt/tg-name-bm.txt <<- "EOF" cat > /opt/tg-name-bm.py <<- "EOF"
#!/bin/bash import csv
############################################################################################################### import requests
# BrandMeister List TG
############################################################################################################### # URL del archivo de texto
wget http://www.pistar.uk/downloads/TGList_BM.txt -O /opt/MMDVMHost-Websocketboard/html/data/TG_List.csv url = "http://www.pistar.uk/downloads/TGList_BM.txt"
sed -i 's/;0;/,/' /opt/MMDVMHost-Websocketboard/html/data/TG_List.csv
sed -i 's/;/,/' /opt/MMDVMHost-Websocketboard/html/data/TG_List.csv # Descargar el archivo de texto
sed -i 's/^ */DMR,2,/' /opt/MMDVMHost-Websocketboard/html/data/TG_List.csv response = requests.get(url)
sed -i 's/,/ /4' /opt/MMDVMHost-Websocketboard/html/data/TG_List.csv content = response.content.decode("utf-8")
echo "DMR,2,9990,Parrot TG9990" >> /opt/MMDVMHost-Websocketboard/html/data/TG_List.csv
# Dividir el contenido del archivo en líneas
lines = content.splitlines()
# Ruta del archivo de salida
output_file_path = "/opt/MMDVMHost-Websocketboard/html/data/TG_List.csv"
# Almacenar los datos en una lista
data = []
# Procesar los datos del archivo original y agregarlos a la lista
for line in lines:
if not line.startswith('#'):
parts = line.split(';')
if len(parts) >= 4:
data.append([int(parts[0]), parts[2], parts[3]])
# Agregar líneas adicionales
data.append([9990, "Parrot", "TG9990"])
data.append([6, "XLX", "TG6"])
# Ordenar la lista por el valor de la columna "id"
data.sort(key=lambda x: x[0])
# Abrir el archivo de salida en modo escritura
with open(output_file_path, "w", newline="") as output_file:
csv_writer = csv.writer(output_file)
# Escribir la primera fila de encabezado
csv_writer.writerow(["DMR", "2", "id", "callsign tgid"])
# Escribir los datos en el nuevo formato
for row in data:
csv_writer.writerow(["DMR", "2", row[0], row[1] + " " + row[2]])
print("Proceso completado. Archivo de salida generado en:", output_file_path)
EOF EOF
################################################################################################################ ################################################################################################################
if [ -f "/bin/tg-name.sh" ]
then
rm /bin/tg-name.sh
fi
cat /opt/tg-name-bm.txt >> /bin/tg-name.sh
chmod +x /bin/tg-name.sh
chmod +x /bin/menu-mmdvm chmod +x /bin/menu-mmdvm
ln -sf /bin/menu-mmdvm /bin/MENU-MMDVM ln -sf /bin/menu-mmdvm /bin/MENU-MMDVM
chmod +x /bin/MENU* chmod +x /bin/MENU*
sh /bin/tg-name.sh python3 /opt/tg-name-bm.py

View File

@ -29,11 +29,66 @@ sudo systemctl stop YSFReflector.service && sudo systemctl start YSFReflector.se
3) 3)
sudo systemctl stop YSFReflector.service && sudo systemctl disable YSFReflector.service ;; sudo systemctl stop YSFReflector.service && sudo systemctl disable YSFReflector.service ;;
4) 4)
sudo systemctl restart logtailer-ysf.service && sudo systemctl enable logtailer-ysf.service && sudo systemctl restart http.server-ysf.service && sudo systemctl enable http.server-ysf.service ;; if sudo systemctl status http.server-ysf.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl disable http.server-ysf.service
fi
if sudo systemctl status http.server-ysf.service |grep active >/dev/null 2>&1
then
sudo systemctl stop http.server-ysf.service
fi
if sudo systemctl status logtailer-ysf.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl disable logtailer-ysf.service
fi
if sudo systemctl status logtailer-ysf.service |grep active >/dev/null 2>&1
then
sudo systemctl stop logtailer-ysf.service
fi
variable80=$(grep "Web-Dashboar-Port:" /opt/wdp4 | grep -Eo '[A.0-9]{1,9}')
if [ -z "$variable80" ]
then variable80=80
fi
sudo sed -i "s/ExecStart=.*/ExecStart=\/usr\/bin\/python3 -m http.server $variable80 --directory \/opt\/WSYSFDash\/html/g" /lib/systemd/system/http.server-ysf.service &&
systemctl daemon-reload &&
if sudo netstat -tuln | grep -q "0.0.0.0:$variable80"; then
whiptail --title "Check Port" --msgbox "El puerto $variable80 esta ocupado , The port $variable80 is busy" 0 50
else
if ! sudo systemctl status http.server-ysf.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl enable http.server-ysf.service
fi
if ! sudo systemctl status logtailer-ysf.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl enable logtailer-ysf.service
fi
sudo systemctl start http.server-ysf.service
sudo systemctl start logtailer-ysf.service
fi ;;
5) 5)
sudo systemctl stop logtailer-ysf.service && sudo systemctl disable logtailer-ysf.service && sudo systemctl stop http.server-ysf.service && sudo systemctl disable http.server-ysf.service ;; sudo systemctl stop logtailer-ysf.service && sudo systemctl disable logtailer-ysf.service && sudo systemctl stop http.server-ysf.service && sudo systemctl disable http.server-ysf.service ;;
6) 6)
sudo nano /lib/systemd/system/http.server-ysf.service && sudo systemctl daemon-reload ;; if sudo systemctl status http.server-ysf.service |grep active >/dev/null 2>&1
then
sudo systemctl stop http.server-ysf.service
fi
sudo nano /opt/wdp4 &&
variable80=$(grep "Web-Dashboar-Port:" /opt/wdp4 | grep -Eo '[A.0-9]{1,9}')
if [ -z "$variable80" ]
then variable80=80
fi
sudo sed -i "s/ExecStart=.*/ExecStart=php -S 0.0.0.0:$variable80 -t \/var\/www\/dvs\//g" /lib/systemd/system/http.server-ysf.service &&
systemctl daemon-reload &&
if sudo netstat -tuln | grep -q "0.0.0.0:$variable80"; then
whiptail --title "Check Port" --msgbox "El puerto $variable80 esta ocupado , The port $variable80 is busy" 0 50
else
if sudo systemctl status http.server-ysf.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl start http.server-ysf.service
fi
fi ;;
7) 7)
sudo nano /opt/WSYSFDash/html/index.html ;; sudo nano /opt/WSYSFDash/html/index.html ;;
8) 8)