emq-TE1/menu/menu-web

36 lines
943 B
Bash

#!/bin/bash
cat > /bin/menu-web <<- "EOF"
#!/bin/bash
while : ; do
choix=$(whiptail --title "Raspbian Proyect HP3ICC Web-Menu" --menu "Suba o Baje con las flechas del teclado y seleccione el numero de opcion" 20 50 11 \
1 " Habilitar Web-Menu " \
2 " Deshabilitar Web-Menu " \
3 " Editar Web-Menu " \
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 systemctl stop gotty.service && sudo systemctl start gotty.service && sudo systemctl enable gotty.service;;
2)
sudo systemctl stop gotty.service && systemctl disable gotty.service ;;
3)
sudo nano /lib/systemd/system/gotty.service && sudo systemctl daemon-reload ;;
4)
break;
esac
done
exit 0
EOF
######
chmod +x /bin/menu-web
ln -sf /bin/menu-web /bin/MENU-WEB
chmod +x /bin/MENU*