aboutsummaryrefslogtreecommitdiffstats
path: root/start.sh
diff options
context:
space:
mode:
authorTyler Baker <tyler.baker@linaro.org>2017-03-31 17:26:12 -0700
committerTyler Baker <tyler.baker@linaro.org>2017-03-31 17:26:12 -0700
commitcb1b234b55714221d380d331145a1e81f9902616 (patch)
tree311d40fa718cb74dd7f965d4a0c4c3bf0839b065 /start.sh
Add base lava-docker files
Signed-off-by: Tyler Baker <tyler.baker@linaro.org>
Diffstat (limited to 'start.sh')
-rwxr-xr-xstart.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/start.sh b/start.sh
new file mode 100755
index 0000000..09ae15f
--- /dev/null
+++ b/start.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+postgres-ready () {
+ echo "Waiting for lavaserver database to be active"
+ while (( $(ps -ef | grep -v grep | grep postgres | grep lavaserver | wc -l) == 0 ))
+ do
+ echo -n "."
+ sleep 1
+ done
+ echo
+ echo "[ ok ] LAVA server ready"
+}
+
+start () {
+ echo "Starting $1"
+ if (( $(ps -ef | grep -v grep | grep -v add_device | grep -v dispatcher-config | grep "$1" | wc -l) > 0 ))
+ then
+ echo "$1 appears to be running"
+ else
+ service "$1" start
+ fi
+}
+
+#remove lava-pid files incase the image is stored without first stopping the services
+rm -f /var/run/lava-*.pid 2> /dev/null
+
+start postgresql
+start apache2
+start lava-server
+start lava-master
+start lava-slave
+start lava-server-gunicorn
+
+postgres-ready
+service apache2 reload #added after the website not running a few times on boot