aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Kronqvist <work.joelkronqvist@gmail.com>2022-10-17 19:43:07 +0300
committerJoel Kronqvist <work.joelkronqvist@gmail.com>2022-10-17 19:43:07 +0300
commit0f8dcba6fe350ffb74331cb636046c30e784ca8d (patch)
tree5e059f0c608c1d01cb0930d8f9c49ba7b2a64768
parent22a4830bb09cbecf6c2e8e52601a4e821bddbe8e (diff)
downloadLYLLRuoka-0f8dcba6fe350ffb74331cb636046c30e784ca8d.tar.gz
LYLLRuoka-0f8dcba6fe350ffb74331cb636046c30e784ca8d.zip
Added instructions to start server at reboot. Doesn't neccessarily work. Updated the init script. No server code updates for now.
-rw-r--r--README.md5
-rwxr-xr-xinit.sh25
2 files changed, 14 insertions, 16 deletions
diff --git a/README.md b/README.md
index 6842ef8..58ed452 100644
--- a/README.md
+++ b/README.md
@@ -126,10 +126,9 @@ You can make the server run automatically on reboot. This hasn't been tested, th
Add to **roots** crontab (run `sudo crontab -e`):
```
-@reboot cd ["BASE DIRECTORY"]/LYLLRuoka && node server.js
-# For example:
-# @reboot cd /home/foobar/LYLLRuoka/LYLLRuoka && node server.js
+@reboot BASE_DIR='["BASE_DIRECTORY"]' ["BASE_DIRECTORY"]/LYLLRuoka/init.sh
```
+For example: `@reboot BASE_DIR='/home/foobar/LYLLRuoka' /home/foobar/LYLLRuoka/LYLLRuoka/init.sh`
# Adding cool data that isn't required for the server to run
diff --git a/init.sh b/init.sh
index 51791d6..55be6ee 100755
--- a/init.sh
+++ b/init.sh
@@ -1,23 +1,22 @@
#!/bin/sh
exec 1>>/tmp/slogs
exec 2>>/tmp/slogs
+echo "========"
echo | date
-echo "Init running"
+echo "# Init running"
-echo "Removing old packages..."
-rm -rf $PATH_TO_LYLLRUOKA
-
-echo "Waiting for connection..."
-while [ ! "$(ping 'www.github.com' -c 1)" ]
-do
+echo "# Waiting for connection..."
+while ! ping 'example.org' -c 1; do
sleep 5
done
+echo "# Connected to internet!"
-cd "${PATH_TO_LYLLRUOKA%%FoodJS}"
-
-echo "Cloning new packages..."
-git clone "https://github.com/JoelHMikael/FoodJS.git"
+echo ""
-cd $PATH_TO_LYLLRUOKA
-echo "Starting server..."
+cd "$BASE_DIR/LYLLRuoka"
+echo "# node server.js:"
node server.js
+
+echo "========"
+echo ""
+echo ""