aboutsummaryrefslogtreecommitdiff
path: root/buildbot/start
diff options
context:
space:
mode:
Diffstat (limited to 'buildbot/start')
-rwxr-xr-xbuildbot/start49
1 files changed, 49 insertions, 0 deletions
diff --git a/buildbot/start b/buildbot/start
new file mode 100755
index 0000000..19346ce
--- /dev/null
+++ b/buildbot/start
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+function psg() {
+ ps awwux | grep -v grep | grep $1
+}
+function botdo() {
+ sudo -u buildbot $*
+}
+
+if [[ $UID != 0 ]]; then
+ echo "Not root? Run 'sudo $0'"
+ exit 1
+fi
+
+mounted=`mount | grep external`
+if [[ $mounted = '' ]]; then
+ echo "Mounting /external"
+ in_fstab=`grep external /etc/fstab`
+ if [[ $in_fstab != '' ]]; then
+ mount /external
+ else
+ mount -t ext4 /dev/sda1 /external
+ fi
+fi
+
+running=`/etc/init.d/ssh status | grep 'is running'`
+if [[ $running = '' ]]; then
+ echo "Starting SSH daemon"
+ iptables -P INPUT ACCEPT
+ /etc/init.d/ssh start
+fi
+
+running=`psg powerd`
+if [[ $running != '' ]]; then
+ echo "Stopping powerd"
+ stop powerd
+fi
+
+buildbot_root=/external/buildbot
+running=`psg buildslave`
+if [[ $running = '' ]]; then
+ echo "Starting buildbot"
+ if [ -f $buildbot_root/twistd.pid ]; then
+ botdo buildslave stop $buildbot_root
+ fi
+ botdo buildslave start $buildbot_root
+fi
+
+echo "System initialized correctly"