aboutsummaryrefslogtreecommitdiff
path: root/init.sh
blob: 3a85f04b8213f884987af5b083824a7eb7be9af6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/sh
exec 1>>/var/slogs
exec 2>>/var/slogs
echo ""
echo "# Init running at $(date)"

echo "# Waiting for connection..."
while ! ping 'example.org' -c 1; do
        sleep 5
done
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"
while echo "# node server.js:"; do
	node server.js

	# Sleep below, so that the loop can't cause too big a load to the server, if the server terminates very fast.
	sleep 5
	echo "# SERVER TERMINATED at $(date)!"
	echo "--------"
done