blob: f7c5f0b1972e0047403de6c5ef769403beee707f [file] [log] [blame]
Renato Golin94cc1042016-04-26 11:02:23 +01001#! /bin/sh
2
3### BEGIN INIT INFO
4# Provides: LLVM Buildbot Slave
5# Required-Start: $local_fs $remote_fs $buildslave
6# Required-Stop:
7# X-Start-Before:
8# Default-Start: 2 3 4 5
9# Default-Stop:
10# Short-Description: Runs tests specified by buildmaster
11# Description: Runs tests specified by buildmaster
12### END INIT INFO
13
14. /lib/lsb/init-functions
15
16N=/etc/init.d/llvmbot
17USER=linaro
18DIR=/home/linaro/devel/buildslave
19PID=twistd.pid
20
21set -e
22
23start() {
24 if [ ! -f $DIR/$PID ]; then
25 su -l -c "buildslave start $DIR" $USER
26 else
27 echo "Buildslave on $DIR already started"
28 fi
29}
30
31stop() {
32 if [ -f $DIR/$PID ]; then
33 su -l -c "buildslave stop $DIR" $USER
34 else
35 echo "Buildslave on $DIR not started"
36 fi
37}
38
39case "$1" in
40 start) start;;
41 stop) stop;;
42 restart)
43 stop; start;;
44 status)
45 if [ -f $DIR/twisted.pid ]; then
46 echo "Buildslave on $DIR active"
47 else
48 echo "Buildslave on $DIR stopped"
49 fi
50 ;;
51 *)
52 echo "Usage: $N {start|stop|restart|status}" >&2
53 exit 1
54 ;;
55esac
56
57exit 0