emq-TE1/menu/menu-nxdn2dmr

45 lines
1.1 KiB
Bash

#!/bin/bash
sudo cat > /bin/menu-nxdn2dmr <<- "EOF"
#!/bin/bash
while : ; do
choix=$(whiptail --title "Raspbian Proyect HP3ICC Menu NXDN2DMR" --menu "Suba o Baje con las flechas del teclado y seleccione el numero de opcion" 20 50 11 \
1 " Editar NXDN2DMR " \
2 " Iniciar NXDN2DMR " \
3 " Detener NXDN2DMR " \
4 " 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/NXDN2DMR/NXDN2DMR.ini;;
2)
python3 /opt/data-mmdvm.py &&
if systemctl status nxdn2dmr.service |grep active >/dev/null 2>&1
then sudo systemctl stop nxdn2dmr.service
fi
if systemctl status nxdn2dmr.service |grep disable >/dev/null 2>&1
then sudo systemctl enable nxdn2dmr.service
fi
sudo systemctl start nxdn2dmr.service ;;
3)
sudo systemctl stop nxdn2dmr.service && sudo systemctl disable nxdn2dmr.service ;;
4)
break;
esac
done
exit 0
EOF
###
chmod +x /bin/menu-nxdn2dmr
ln -sf /bin/menu-nxdn2dmr /bin/MENU-NXDN2DMR
chmod +x /bin/MENU*