From bccbe3dad62e7541286ac4e2f56fa60afe94e882 Mon Sep 17 00:00:00 2001 From: Skylar Grant Date: Sun, 24 Nov 2024 19:20:44 -0500 Subject: [PATCH] Improve panel --- src/_EMR/panel.sh | 116 +++++++++++++++++++++++++--------------------- 1 file changed, 62 insertions(+), 54 deletions(-) mode change 100644 => 100755 src/_EMR/panel.sh diff --git a/src/_EMR/panel.sh b/src/_EMR/panel.sh old mode 100644 new mode 100755 index 3561999..8021432 --- a/src/_EMR/panel.sh +++ b/src/_EMR/panel.sh @@ -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 \ No newline at end of file + # 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 \ No newline at end of file