emq-TE1/menu/menu-fdmr

67 lines
3.1 KiB
Plaintext

sudo cat > /bin/menu-fdmr <<- "EOF"
#!/bin/bash
while : ; do
choix=$(whiptail --title "Raspbian Proyect HP3ICC Menu FreeDMR" --menu "Suba o Baje con las flechas del teclado y seleccione el numero de opcion:" 23 56 13 \
1 " Editar FreeDMR Server " \
2 " Editar Interlink " \
3 " Editar FDMR-Monitor " \
4 " Editar Puerto HTTP " \
5 " Parrot on " \
6 " Parrot off " \
7 " FreeDMR Start & Restart " \
8 " FreeDMR Server Stop " \
9 " Dashboard Start & Restart " \
10 " Dashboard Stop " \
11 " D-APRS Igate " \
12 " Menu Principal " 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)
sudo systemctl stop fdmrparrot.service && sudo systemctl start fdmrparrot.service && sudo systemctl enable fdmrparrot.service ;;
6)
sudo systemctl stop fdmrparrot.service && sudo systemctl disable fdmrparrot.service ;;
7)
sudo systemctl start mariadb.service && sudo systemctl enable mariadb.service && sudo systemctl stop proxy.service && sudo systemctl start proxy.service && sudo systemctl enable proxy.service && sudo systemctl stop freedmr.service && sudo systemctl start freedmr.service && sudo systemctl enable freedmr.service && cronedit.sh '* */12 * * *' 'data-id' add;;
8)
sudo systemctl stop freedmr.service && sudo systemctl disable freedmr.service && sudo systemctl stop proxy.service && sudo systemctl disable proxy.service && cronedit.sh '* */12 * * *' 'data-id' remove &&
if systemctl status freedmr.service |grep inactive >/dev/null 2>&1 && systemctl status fdmr_mon.service |grep inactive >/dev/null 2>&1
then
systemctl stop mariadb.service
systemctl disable mariadb.service
fi ;;
9)
sudo systemctl start mariadb.service && sudo systemctl enable mariadb.service && sudo systemctl stop fdmr_mon.service && sudo rm /opt/FDMR-Monitor/sysinfo/*.rrd && sh /opt/FDMR-Monitor/sysinfo/rrd-db.sh && cronedit.sh '*/5 * * * *' 'sh /opt/FDMR-Monitor/sysinfo/graph.sh' add && cronedit.sh '*/2 * * * *' 'sh /opt/FDMR-Monitor/sysinfo/cpu.sh' add && sudo systemctl enable fdmr_mon.service && sudo systemctl restart http.server-fdmr.service && sudo systemctl enable http.server-fdmr.service && sudo systemctl start fdmr_mon.service;;
10)
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 && cronedit.sh '*/5 * * * *' 'sh /opt/FDMR-Monitor/sysinfo/graph.sh' remove && cronedit.sh '*/2 * * * *' 'sh /opt/FDMR-Monitor/sysinfo/cpu.sh' remove &&
if systemctl status freedmr.service |grep inactive >/dev/null 2>&1 && systemctl status fdmr_mon.service |grep inactive >/dev/null 2>&1
then
systemctl stop mariadb.service
systemctl disable mariadb.service
fi ;;
11)
menu-igate ;;
12)
break;
esac
done
exit 0
EOF
######
chmod +x /bin/menu-fdmr