From afce8a68a75234cd741395838b5c4c342c6d3595 Mon Sep 17 00:00:00 2001 From: Skylar Grant Date: Thu, 12 Jan 2023 19:51:41 -0500 Subject: [PATCH] Bug fixes --- functions.js | 12 ++++++++++-- hestia.sh | 5 +++-- quit | 0 templates/config.json | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) delete mode 100644 quit diff --git a/functions.js b/functions.js index e25e03f..6a757f2 100644 --- a/functions.js +++ b/functions.js @@ -132,7 +132,10 @@ const functions = { return new Promise((resolve) => { if (config.debugMode) console.log(`[${(Date.now() - config.timestamps.procStart)/1000}] I: Pausing for ${config.intervals.pause}ms`); - functions.sleep(config.intervals.pause).then(() => { resolve(); }); + functions.sleep(config.intervals.pause).then((res) => { + if (config.debugMode) console.log(`[${(Date.now() - config.timestamps.procStart)/1000}] I: Pause finished.`); + resolve(); + }); }); }, // Reload the environment variables on the fly @@ -239,7 +242,10 @@ const functions = { }); }, checkForQuit() { - if (config.status.shutdownNextCycle == 1) process.exit(); + if (config.status.shutdownNextCycle == 1) { + console.log(`[${(Date.now() - config.timestamps.procStart)/1000}] I: Exiting Process!`); + process.exit(); + } return new Promise((resolve, reject) => { if (fs.existsSync('./quit')) { fs.unlink('./quit', err => { @@ -248,6 +254,8 @@ const functions = { config.status.auger = 0; resolve(); }); + } else { + resolve('Not shutting down'); } }); }, diff --git a/hestia.sh b/hestia.sh index 83ca09c..1b01a86 100755 --- a/hestia.sh +++ b/hestia.sh @@ -35,6 +35,7 @@ echo -e " [ Hestia Control Panel ] This script is being run from: '$(pwd)' +Active Nodes: $(ps ax -o pid,user,command | grep 'node websvr.js' | grep -v grep) Please enter an option from below: @@ -45,7 +46,7 @@ Please enter an option from below: [0] Quit Control Panel" # Wait for input -read -p " Option: " opt +read -p "Option: " opt # Execute the correct commands based on input. case "$opt" in @@ -64,7 +65,7 @@ case "$opt" in 3) # View logs clear - cat log.txt | less + less log.txt ;; 0) # Exit the script diff --git a/quit b/quit deleted file mode 100644 index e69de29..0000000 diff --git a/templates/config.json b/templates/config.json index 95b304b..875e0b6 100644 --- a/templates/config.json +++ b/templates/config.json @@ -1,5 +1,5 @@ { - "debugMode": false, + "debugMode": true, "status": { "igniter": 0, "blower": 0,