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
#########################################################################################################################
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
git clone https://github.com/IZ7BOJ/direwolf_webstat.git
#cd /opt/direwolf_webstat

View File

@ -101,6 +101,19 @@ esac
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/
wget https://gitlab.com/hp3icc/DVSwitch-Mobile-TG-List/-/raw/main/lang.sh
sudo chmod +x lang.sh

View File

@ -519,6 +519,19 @@ EOF
# MMDVMHost - Dashboard WebSocket
#################################################################################################################################
#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")

View File

@ -65,7 +65,19 @@ EOF
#########################################################################################################################
# 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/
git clone --recurse-submodules -j8 https://github.com/dg9vh/WSYSFDash
cd /opt/WSYSFDash/

View File

@ -85,11 +85,51 @@ rm /var/log/mmdvm/*;;
3)
sudo /usr/local/dvs/dvs ;;
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)
sudo systemctl stop http.server-dvs.service
sudo systemctl start http.server-dvs.service
sudo systemctl enable http.server-dvs.service ;;
if sudo systemctl status http.server-dvs.service |grep "service; enabled;" >/dev/null 2>&1
then
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)
sudo systemctl stop http.server-dvs.service && sudo systemctl disable http.server-dvs.service ;;
7)

View File

@ -9,7 +9,7 @@ choix=$(whiptail --title "Raspbian Proyect HP3ICC Menu Direwolf" --menu "Suba o
3 " Edit Frecuency SDR-RTL " \
4 " Edit Direwolf Tracker " \
5 " Edit Dashboard " \
6 " Edit port http Dashbord " \
6 " Select Web Dashboard Port " \
7 " Start Direwolf SDR-RTL" \
8 " Start Direwolf Tracker" \
9 " Start Direwolf Analogo" \
@ -38,10 +38,25 @@ sudo nano /opt/direwolf/gpsd.conf;;
5)
sudo nano /opt/direwolf_webstat/config.php;;
6)
sudo nano /lib/systemd/system/http.server-dw.service && sudo systemctl daemon-reload &&
if systemctl status http.server-dw.service |grep running >/dev/null 2>&1
if sudo systemctl status http.server-dw.service |grep active >/dev/null 2>&1
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 ;;
7)
sudo systemctl stop direwolf.service
@ -111,40 +126,91 @@ fi
sudo systemctl start direwolf.service
sudo systemctl enable direwolf.service ;;
10)
sudo systemctl stop direwolf.service
sudo systemctl stop http.server-dw.service
if [ "$(cat /proc/cpuinfo | grep 'Zero')" != "" ]; then
if systemctl status http.server-dw.service |grep "service; enabled;" >/dev/null 2>&1
then sudo systemctl disable http.server-dw.service
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 chmod +x /usr/local/bin/direwolf
else
else
sudo cp /opt/direwolf/direwolf2 /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 systemctl daemon-reload
sudo systemctl start direwolf.service
sudo systemctl start http.server-dw.service
sudo systemctl enable http.server-dw.service
sudo systemctl enable direwolf.service ;;
sudo systemctl enable direwolf.service
fi ;;
11)
sudo systemctl stop direwolf.service
sudo systemctl stop 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
if systemctl status http.server-dw.service |grep "service; enabled;" >/dev/null 2>&1
then sudo systemctl disable http.server-dw.service
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/ExecStart=.*/ExecStart=\/bin\/sh \/opt\/direwolf\/rtl.sh/" /lib/systemd/system/direwolf.service
sudo systemctl daemon-reload
sudo systemctl start direwolf.service
sudo systemctl start http.server-dw.service
sudo systemctl enable http.server-dw.service
sudo systemctl enable direwolf.service ;;
sudo systemctl enable direwolf.service
fi ;;
12)
if systemctl status http.server-dw.service | grep enable >/dev/null 2>&1
then

View File

@ -30,9 +30,17 @@ fi
# case : action en fonction du choix
case $choix in
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)
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)
sudo nano /opt/FDMR-Monitor/fdmr-mon.cfg ;;
4)
@ -47,41 +55,34 @@ if sudo systemctl status http.server-fdmr2.service |grep active >/dev/null 2>&1
then
sudo systemctl stop http.server-fdmr2.service
fi &&
variable1=$(grep "Web-Dashboar-Port:" /opt/wdp | grep -Eo '[A.0-9]{1,9}') &&
if [ -z "$variable1" ]
then variable1=80
variable80=$(grep "Web-Dashboar-Port:" /opt/wdp | 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:$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
if sudo systemctl status http.server-fdmr2.service |grep "service; enabled;" >/dev/null 2>&1
then
sudo systemctl start http.server-fdmr2.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:$variable80 -t \/var\/www\/fdmr2\//g" /lib/systemd/system/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 ;;
6)
if systemctl status mariadb.service |grep inactive >/dev/null 2>&1
then sudo systemctl start mariadb.service
if ! systemctl status mariadb.service |grep "Active: active" >/dev/null 2>&1
then sudo systemctl restart mariadb.service
fi
if systemctl status mariadb.service |grep disable >/dev/null 2>&1
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
if ! systemctl status mariadb.service |grep "service; enabled;" >/dev/null 2>&1
then sudo systemctl enable mariadb.service
fi
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
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
sudo systemctl start freedmr.service
sudo systemctl start fdmrparrot.service
@ -109,21 +122,21 @@ sudo systemctl disable freedmr.service
# Verificar el estado del servicio mariadb.service
if systemctl is-enabled mariadb.service | grep -q "disabled"; then
echo "El servicio mariadb está deshabilitado."
echo "El servicio mariadb esta deshabilitado."
else
# Verificar el estado del servicio freedmr-fdmr.service
if systemctl is-enabled freedmr.service | grep -q "enabled"; then
echo "El servicio freedmr está habilitado."
echo "El servicio freedmr esta habilitado."
else
# Verificar el estado del servicio http.server-fdmr.service
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
# Verificar el estado del servicio http.server-fdmr2.service
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
# Si todo está bien, deshabilitar el servicio mariadb.service
# Si todo esta bien, deshabilitar el servicio mariadb.service
systemctl disable mariadb.service
systemctl stop mariadb.service
echo "El servicio mariadb ha sido deshabilitado."
@ -133,151 +146,173 @@ else
fi
;;
8)
(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 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
if systemctl status http.server-fdmr.service |grep "service; enabled;" >/dev/null 2>&1
then sudo systemctl disable http.server-fdmr.service
fi
if systemctl status http.server-fdmr2.service |grep "service; enabled;" >/dev/null 2>&1
then sudo systemctl disable http.server-fdmr2.service
fi
if ! systemctl status http.server-fdmr.service | grep "service; enabled;" >/dev/null 2>&1; then
sudo systemctl enable http.server-fdmr.service
if systemctl status fdmr_mon.service |grep "service; enabled;" >/dev/null 2>&1
then sudo systemctl disable fdmr_mon.service
fi
if systemctl status fdmr_mon2.service |grep "service; enabled;" >/dev/null 2>&1
then sudo systemctl disable fdmr_mon2.service
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
then
sudo systemctl stop http.server-fdmr.service
fi &&
fi
if sudo systemctl status http.server-fdmr2.service |grep active >/dev/null 2>&1
then
sudo systemctl stop http.server-fdmr2.service
fi &&
variable1=$(grep "Web-Dashboar-Port:" /opt/wdp | grep -Eo '[A.0-9]{1,9}') &&
if [ -z "$variable1" ]
then variable1=80
fi
if sudo systemctl status fdmr_mon.service |grep active >/dev/null 2>&1
then
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 &&
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 &&
fi
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:$variable80 -t \/var\/www\/fdmr2\//g" /lib/systemd/system/http.server-fdmr2.service &&
systemctl daemon-reload &&
if systemctl status fdmr_mon2.service |grep active >/dev/null 2>&1
then sudo systemctl stop fdmr_mon2.service
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
(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
if systemctl status fdmr_mon.service |grep active >/dev/null 2>&1
then sudo systemctl stop fdmr_mon.service
fi
if ! systemctl status mariadb.service |grep "service; enabled;" >/dev/null 2>&1
then sudo systemctl enable mariadb.service
fi
rm /opt/FDMR-Monitor/data/*
mysql -u root -e "DROP TABLE IF EXISTS selfcare.last_heard;" &&
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 start http.server-fdmr.service ;;
fi
if ! systemctl status proxy.service | grep "service; enabled;" >/dev/null 2>&1; then
sudo systemctl enable proxy.service
fi
if ! systemctl status proxy.service | grep "Active: active" >/dev/null 2>&1; then
sudo systemctl restart proxy.service
fi
#####################################
rm /opt/FDMR-Monitor/data/*
mysql -u root -e "DROP TABLE IF EXISTS selfcare.last_heard;" &&
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)
(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
then sudo systemctl disable http.server-fdmr.service
fi
if ! systemctl status http.server-fdmr2.service | grep "service; enabled;" >/dev/null 2>&1; then
sudo systemctl enable http.server-fdmr2.service
if systemctl status http.server-fdmr2.service |grep "service; enabled;" >/dev/null 2>&1
then sudo systemctl disable http.server-fdmr2.service
fi
if systemctl status fdmr_mon.service |grep "service; enabled;" >/dev/null 2>&1
then sudo systemctl disable fdmr_mon.service
fi
if ! systemctl status fdmr_mon2.service | grep "service; enabled;" >/dev/null 2>&1; then
sudo systemctl enable fdmr_mon2.service
fi
if ! systemctl status proxy.service | grep "service; enabled;" >/dev/null 2>&1; then
sudo systemctl enable proxy.service
if systemctl status fdmr_mon2.service |grep "service; enabled;" >/dev/null 2>&1
then sudo systemctl disable fdmr_mon2.service
fi
#####################################
if sudo systemctl status http.server-fdmr.service |grep active >/dev/null 2>&1
then
sudo systemctl stop http.server-fdmr.service
fi &&
fi
if sudo systemctl status http.server-fdmr2.service |grep active >/dev/null 2>&1
then
sudo systemctl stop http.server-fdmr2.service
fi &&
variable1=$(grep "Web-Dashboar-Port:" /opt/wdp | grep -Eo '[A.0-9]{1,9}') &&
if [ -z "$variable1" ]
then variable1=80
fi
if sudo systemctl status fdmr_mon.service |grep active >/dev/null 2>&1
then
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 &&
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 &&
fi
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:$variable80 -t \/var\/www\/fdmr2\//g" /lib/systemd/system/http.server-fdmr2.service &&
systemctl daemon-reload &&
if systemctl status fdmr_mon.service |grep active >/dev/null 2>&1
then sudo systemctl stop fdmr_mon.service
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
(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
if systemctl status fdmr_mon2.service |grep active >/dev/null 2>&1
then sudo systemctl stop fdmr_mon2.service
fi
if ! systemctl status mariadb.service |grep "service; enabled;" >/dev/null 2>&1
then sudo systemctl enable mariadb.service
fi
rm /opt/FDMR-Monitor2/data/*
mysql -u root -e "DROP TABLE IF EXISTS selfcare.last_heard;" &&
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 start http.server-fdmr2.service ;;
fi
if ! systemctl status proxy.service | grep "service; enabled;" >/dev/null 2>&1; then
sudo systemctl enable proxy.service
fi
if ! systemctl status proxy.service | grep "Active: active" >/dev/null 2>&1; then
sudo systemctl restart proxy.service
fi
#####################################
rm /opt/FDMR-Monitor2/data/*
mysql -u root -e "DROP TABLE IF EXISTS selfcare.last_heard;" &&
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)
(crontab -l | grep -v "rm /opt/FDMR-Monitor2/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
if systemctl is-enabled mariadb.service | grep -q "disabled"; then
echo "El servicio mariadb está deshabilitado."
echo "El servicio mariadb está deshabilitado."
else
# Verificar el estado del servicio freedmr-fdmr.service
if systemctl is-enabled freedmr.service | grep -q "enabled"; then
echo "El servicio freedmr está habilitado."
echo "El servicio freedmr está habilitado."
else
# Verificar el estado del servicio http.server-fdmr.service
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
# Verificar el estado del servicio http.server-fdmr2.service
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
# Si todo está bien, deshabilitar el servicio mariadb.service
# Si todo está bien, deshabilitar el servicio mariadb.service
systemctl disable mariadb.service
systemctl stop mariadb.service
echo "El servicio mariadb ha sido deshabilitado."
@ -325,7 +360,6 @@ esac
done
exit 0
EOF
################
sudo chmod +x /bin/menu*

View File

@ -84,27 +84,74 @@ then
fi
sudo systemctl stop mmdvmh.service && sudo systemctl disable mmdvmh.service && systemctl stop ysf2dmrgw.service && sudo systemctl stop dmrgw.service ;;
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)
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)
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)
sudo nano /opt/MMDVMHost-Websocketboard/html/index.html ;;
11)
sudo nano /opt/MMDVMHost-Websocketboard/html/js/config.js ;;
12)
if [ -f "/bin/tg-name.sh" ]
then
rm /bin/tg-name.sh
fi
cat /opt/tg-name-fdmr.txt >> /bin/tg-name.sh && sh /bin/tg-name.sh ;;
python3 /opt/tg-name-fdmr.py ;;
13)
if [ -f "/bin/tg-name.sh" ]
then
rm /bin/tg-name.sh
fi
cat /opt/tg-name-bm.txt >> /bin/tg-name.sh && sh /bin/tg-name.sh ;;
python3 /opt/tg-name-bm.py ;;
14)
break;
esac
@ -112,36 +159,108 @@ done
exit 0
EOF
#######
cat > /opt/tg-name-fdmr.txt <<- "EOF"
#!/bin/bash
###############################################################################################################
# FreeDMR List TG
###############################################################################################################
wget http://downloads.freedmr.uk/downloads/talkgroup_ids.csv -O /opt/MMDVMHost-Websocketboard/html/data/TG_List.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
echo "DMR,2,9990,Parrot TG9990" >> /opt/MMDVMHost-Websocketboard/html/data/TG_List.csv
cat > /opt/tg-name-fdmr.py <<- "EOF"
import csv
import requests
# URL del archivo CSV
url = "https://freedmr.cymru/talkgroups/talkgroup_ids.csv"
# Descargar el archivo 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
cat > /opt/tg-name-bm.txt <<- "EOF"
#!/bin/bash
###############################################################################################################
# BrandMeister List TG
###############################################################################################################
wget http://www.pistar.uk/downloads/TGList_BM.txt -O /opt/MMDVMHost-Websocketboard/html/data/TG_List.csv
sed -i 's/;0;/,/' /opt/MMDVMHost-Websocketboard/html/data/TG_List.csv
sed -i 's/;/,/' /opt/MMDVMHost-Websocketboard/html/data/TG_List.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
echo "DMR,2,9990,Parrot TG9990" >> /opt/MMDVMHost-Websocketboard/html/data/TG_List.csv
cat > /opt/tg-name-bm.py <<- "EOF"
import csv
import requests
# URL del archivo de texto
url = "http://www.pistar.uk/downloads/TGList_BM.txt"
# Descargar el archivo de texto
response = requests.get(url)
content = response.content.decode("utf-8")
# 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
################################################################################################################
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
ln -sf /bin/menu-mmdvm /bin/MENU-MMDVM
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)
sudo systemctl stop YSFReflector.service && sudo systemctl disable YSFReflector.service ;;
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)
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)
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)
sudo nano /opt/WSYSFDash/html/index.html ;;
8)