Improve panel

This commit is contained in:
Skylar Grant 2024-11-24 19:20:44 -05:00
parent 225d464ad6
commit bccbe3dad6

116
src/_EMR/panel.sh Normal file → Executable file
View File

@ -4,59 +4,67 @@
ROOT_PATH="/srv/hestia" ROOT_PATH="/srv/hestia"
EMR_FOLDER="src/_EMR" EMR_FOLDER="src/_EMR"
# Prompt for input
echo "##########################################"
echo "# Hestia Emergency Control Panel #"
echo "##########################################"
echo "# 1. Exhaust ON #"
echo "# 2. Exhaust OFF #"
echo "# 3. Igniter ON #"
echo "# 4. Igniter OFF #"
echo "# 5. Start Auger Loop #"
echo "# 6. Stop Auger Loop #"
echo "##########################################"
echo "# 0. Exit #"
echo "##########################################"
# Read user input # Loop
read -p "Menu Option: " choice while true; do
# Prompt for input
echo "##########################################"
echo "# Hestia Emergency Control Panel #"
echo "##########################################"
echo "# 1. Exhaust ON #"
echo "# 2. Exhaust OFF #"
echo "# 3. Igniter ON #"
echo "# 4. Igniter OFF #"
echo "# 5. Start Auger Loop #"
echo "# 6. Stop Auger Loop #"
echo "##########################################"
echo "# 0. Exit #"
echo "##########################################"
# Switch case on input # Read user input
case $choice in read -p "Menu Option: " choice
1)
echo "Turning Exhaust ON" # Switch case on input
cd $ROOT_PATH case $choice in
node $EMR_FOLDER/exh_on.js 1)
;; echo "Turning Exhaust ON"
2) cd $ROOT_PATH
echo "Turning Exhaust OFF" node $EMR_FOLDER/exh_on.js
cd $ROOT_PATH # Return to the prompt
node $EMR_FOLDER/exh_off.js
;; ;;
3) 2)
echo "Turning Igniter ON" echo "Turning Exhaust OFF"
cd $ROOT_PATH cd $ROOT_PATH
node $EMR_FOLDER/ign_on.js node $EMR_FOLDER/exh_off.js
;; ;;
4) 3)
echo "Turning Igniter OFF" echo "Turning Igniter ON"
cd $ROOT_PATH cd $ROOT_PATH
node $EMR_FOLDER/ign_off.js node $EMR_FOLDER/ign_on.js
;; ;;
5) 4)
echo "Starting Auger Loop" echo "Turning Igniter OFF"
cd $ROOT_PATH cd $ROOT_PATH
pm2 start $EMR_FOLDER/auger_loop.js --name hestia-emr node $EMR_FOLDER/ign_off.js
;; ;;
6) 5)
echo "Stopping Auger Loop" echo "Starting Auger Loop"
cd $ROOT_PATH cd $ROOT_PATH
pm2 stop hestia-emr pm2 start $EMR_FOLDER/auger_loop.js --name hestia-emr
;; ;;
0) 6)
echo "Exiting" echo "Stopping Auger Loop"
;; cd $ROOT_PATH
*) pm2 stop hestia-emr
echo "Invalid input" ;;
;; 0)
esac echo "Exiting"
exit
break
;;
*)
echo "Invalid input"
;;
esac
done