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"
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
read -p "Menu Option: " choice
# Loop
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
case $choice in
1)
echo "Turning Exhaust ON"
cd $ROOT_PATH
node $EMR_FOLDER/exh_on.js
;;
2)
echo "Turning Exhaust OFF"
cd $ROOT_PATH
node $EMR_FOLDER/exh_off.js
;;
3)
echo "Turning Igniter ON"
cd $ROOT_PATH
node $EMR_FOLDER/ign_on.js
;;
4)
echo "Turning Igniter OFF"
cd $ROOT_PATH
node $EMR_FOLDER/ign_off.js
;;
5)
echo "Starting Auger Loop"
cd $ROOT_PATH
pm2 start $EMR_FOLDER/auger_loop.js --name hestia-emr
;;
6)
echo "Stopping Auger Loop"
cd $ROOT_PATH
pm2 stop hestia-emr
;;
0)
echo "Exiting"
;;
*)
echo "Invalid input"
;;
esac
# Read user input
read -p "Menu Option: " choice
# Switch case on input
case $choice in
1)
echo "Turning Exhaust ON"
cd $ROOT_PATH
node $EMR_FOLDER/exh_on.js
# Return to the prompt
;;
2)
echo "Turning Exhaust OFF"
cd $ROOT_PATH
node $EMR_FOLDER/exh_off.js
;;
3)
echo "Turning Igniter ON"
cd $ROOT_PATH
node $EMR_FOLDER/ign_on.js
;;
4)
echo "Turning Igniter OFF"
cd $ROOT_PATH
node $EMR_FOLDER/ign_off.js
;;
5)
echo "Starting Auger Loop"
cd $ROOT_PATH
pm2 start $EMR_FOLDER/auger_loop.js --name hestia-emr
;;
6)
echo "Stopping Auger Loop"
cd $ROOT_PATH
pm2 stop hestia-emr
;;
0)
echo "Exiting"
exit
break
;;
*)
echo "Invalid input"
;;
esac
done