Bug fixes

This commit is contained in:
Skylar Grant 2023-01-12 19:51:41 -05:00
parent da745e212f
commit afce8a68a7
4 changed files with 14 additions and 5 deletions

View File

@ -132,7 +132,10 @@ const functions = {
return new Promise((resolve) => { return new Promise((resolve) => {
if (config.debugMode) console.log(`[${(Date.now() - config.timestamps.procStart)/1000}] I: Pausing for ${config.intervals.pause}ms`); 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 // Reload the environment variables on the fly
@ -239,7 +242,10 @@ const functions = {
}); });
}, },
checkForQuit() { 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) => { return new Promise((resolve, reject) => {
if (fs.existsSync('./quit')) { if (fs.existsSync('./quit')) {
fs.unlink('./quit', err => { fs.unlink('./quit', err => {
@ -248,6 +254,8 @@ const functions = {
config.status.auger = 0; config.status.auger = 0;
resolve(); resolve();
}); });
} else {
resolve('Not shutting down');
} }
}); });
}, },

View File

@ -35,6 +35,7 @@ echo -e "
[ Hestia Control Panel ] [ Hestia Control Panel ]
This script is being run from: '$(pwd)' 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: Please enter an option from below:
@ -45,7 +46,7 @@ Please enter an option from below:
[0] Quit Control Panel" [0] Quit Control Panel"
# Wait for input # Wait for input
read -p " Option: " opt read -p "Option: " opt
# Execute the correct commands based on input. # Execute the correct commands based on input.
case "$opt" in case "$opt" in
@ -64,7 +65,7 @@ case "$opt" in
3) 3)
# View logs # View logs
clear clear
cat log.txt | less less log.txt
;; ;;
0) 0)
# Exit the script # Exit the script

0
quit
View File

View File

@ -1,5 +1,5 @@
{ {
"debugMode": false, "debugMode": true,
"status": { "status": {
"igniter": 0, "igniter": 0,
"blower": 0, "blower": 0,