blob: 19346ce093b3850e305a788a7abf21a7f555df83 (
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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"
|