aboutsummaryrefslogtreecommitdiffstats
path: root/lava-master/scripts/start.sh
diff options
context:
space:
mode:
authorKevin Hilman <khilman@baylibre.com>2019-06-27 16:26:04 -0700
committerGitHub <noreply@github.com>2019-06-27 16:26:04 -0700
commitc0be09b6ddfd855eeadb3628a481f9c0bb4e26b7 (patch)
treebbe706a7ad9df904529415efb2052bd2e1396f14 /lava-master/scripts/start.sh
parentb9e4d31719373b52c7113d0e8a960332fd8ef8c6 (diff)
parentd791251fbc4a739f4479a358544d434540c0b02a (diff)
Merge pull request #95 from montjoie/pre-2019.05
Pre 2019.05
Diffstat (limited to 'lava-master/scripts/start.sh')
-rwxr-xr-xlava-master/scripts/start.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/lava-master/scripts/start.sh b/lava-master/scripts/start.sh
new file mode 100755
index 0000000..ce94c39
--- /dev/null
+++ b/lava-master/scripts/start.sh
@@ -0,0 +1,38 @@
+#!/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
+
+/etc/init.d/postgresql start
+
+/setup.sh || exit $?
+
+start apache2 || exit $?
+start lava-logs || exit $?
+start lava-master || exit $?
+start lava-coordinator || exit $?
+start lava-server-gunicorn || exit $?
+
+postgres-ready
+service apache2 reload #added after the website not running a few times on boot