From 9755d86ca5954ae2f1a25462e672656234a075e4 Mon Sep 17 00:00:00 2001 From: RaspbianProyect by HP3ICC Date: Sun, 2 Jul 2023 17:03:18 +0000 Subject: [PATCH] Add new file --- menu/menu-fdmr | 120 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 menu/menu-fdmr diff --git a/menu/menu-fdmr b/menu/menu-fdmr new file mode 100644 index 0000000..24e9b4a --- /dev/null +++ b/menu/menu-fdmr @@ -0,0 +1,120 @@ +#!/bin/bash +sudo cat > /bin/menu-fdmr <<- "EOF" +#!/bin/bash +if [[ $EUID -ne 0 ]]; then + whiptail --title "sudo su" --msgbox "requiere ser usuario root , escriba (sudo su) antes de entrar a menu / requires root user, type (sudo su) before entering menu" 0 50 + exit 0 +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 Interlink " \ +3 " Edit FDMR-Monitor " \ +4 " Edit Port HTTP " \ +5 " Start-Restart FreeDMR Server " \ +6 " Start-Restart FDMR-Monitor " \ +7 " Stop FreeDMR SERVER " \ +8 " Stop FDMR-Monitor " \ +9 " D-APRS " \ +10 " Menu update " 3>&1 1>&2 2>&3) +exitstatus=$? +#on recupere ce choix +#exitstatus=$? +if [ $exitstatus = 0 ]; then + echo "Your chosen option:" $choix +else + echo "You chose cancel."; break; +fi +# case : action en fonction du choix +case $choix in +1) +sudo nano /opt/FreeDMR/config/FreeDMR.cfg ;; +2) +sudo nano /opt/FreeDMR/config/rules.py ;; +3) +sudo nano /opt/FDMR-Monitor/fdmr-mon.cfg ;; +4) +sudo nano /lib/systemd/system/http.server-fdmr.service && systemctl daemon-reload && systemctl restart http.server-fdmr.service ;; +5) +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 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 +if systemctl status fdmrparrot.service |grep disable >/dev/null 2>&1 +then sudo systemctl enable fdmrparrot.service + +fi +if systemctl status proxy.service |grep disable >/dev/null 2>&1 +then sudo systemctl enable proxy.service + +fi +if systemctl status freedmr.service |grep disable >/dev/null 2>&1 +then sudo systemctl enable freedmr.service + +fi +sudo systemctl start freedmr.service +sudo systemctl start fdmrparrot.service +sudo systemctl start proxy.service ;; +6) +cronedit.sh '*/5 * * * *' 'sh /opt/FDMR-Monitor/sysinfo/graph.sh' add +cronedit.sh '*/2 * * * *' 'sh /opt/FDMR-Monitor/sysinfo/cpu.sh' add +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 active >/dev/null 2>&1 +then sudo systemctl stop http.server-fdmr.service + +fi +if systemctl status fdmr_mon.service |grep active >/dev/null 2>&1 +then sudo systemctl stop fdmr_mon.service + +fi +sudo systemctl start fdmr_mon.service +sudo systemctl start http.server-fdmr.service ;; +7) +sudo systemctl stop fdmrparrot.service +sudo systemctl disable fdmrparrot.service +sudo systemctl stop proxy.service +sudo systemctl disable proxy.service +sudo systemctl stop freedmr.service +sudo systemctl disable freedmr.service +sudo systemctl stop mariadb.service +sudo systemctl disable mariadb.service ;; +8) +cronedit.sh '*/5 * * * *' 'sh /opt/FDMR-Monitor/sysinfo/graph.sh' remove +cronedit.sh '*/2 * * * *' 'sh /opt/FDMR-Monitor/sysinfo/cpu.sh' remove +sudo systemctl stop fdmr_mon.service +sudo systemctl disable fdmr_mon.service +sudo systemctl stop http.server-fdmr.service +sudo systemctl disable http.server-fdmr.service;; +9) +menu-igate ;; +10) +bash -c "$(curl -fsSL https://gitlab.com/hp3icc/fdmr/-/raw/main/update.sh)"; +esac +done +exit 0 +EOF +### +chmod +x /bin/menu-fdmr