aboutsummaryrefslogtreecommitdiff
path: root/init.sh
blob: fb5d61196903029a6d71d3f8d748e49b14961f98 (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
32
33
#!/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 "--------"
	echo ""
	echo ""
done