aboutsummaryrefslogtreecommitdiff
path: root/init.sh
diff options
context:
space:
mode:
authorJoel Kronqvist <work.joelkronqvist@gmail.com>2022-10-18 21:41:31 +0300
committerJoel Kronqvist <work.joelkronqvist@gmail.com>2022-10-18 21:41:31 +0300
commitc28fe49a7a303ef0440ccffd830e4949a1f2381f (patch)
tree802cf959381c9d4bcc5b1ce9fabd8d8a524ff834 /init.sh
parent82eb5ff8594db3b0382be812253f4dae3f06425f (diff)
downloadLYLLRuoka-c28fe49a7a303ef0440ccffd830e4949a1f2381f.tar.gz
LYLLRuoka-c28fe49a7a303ef0440ccffd830e4949a1f2381f.zip
Enhanced robustness in retrieving the example input and in the init (at reboot) script.
The server errored out if the database was empty and there came a request, as it didn't check for empty arrays in dbparse.js in the function getRandomIndex. Fixed by adding handling & recursion limit. Added in init.sh a check to see if logging in to MySQL is possible to prevent errors at startup.
Diffstat (limited to 'init.sh')
-rwxr-xr-xinit.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/init.sh b/init.sh
index 55be6ee..2fc915d 100755
--- a/init.sh
+++ b/init.sh
@@ -13,6 +13,14 @@ echo "# Connected to internet!"
echo ""
+echo "# Testing DB availability"
+while ! echo 'exit' | mysql; do
+ sleep 5
+done
+echo "# Database seems to be available (ignore error messages above)"
+
+echo ""
+
cd "$BASE_DIR/LYLLRuoka"
echo "# node server.js:"
node server.js