3
# Copyright 2009 Canonical Ltd. This software is licensed under the
4
# GNU Affero General Public License version 3 (see the file LICENSE).
7
# This file is used to start and stop launchpad buildds
10
# Provides: launchpad_buildd
11
# Required-Start: $local_fs $network $syslog $time
12
# Required-Stop: $local_fs $network $syslog $time
13
# Default-Start: 2 3 4 5
15
# X-Interactive: false
16
# Short-Description: Start/stop launchpad buildds
21
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
22
DESC="launchpad build slaves"
24
TACFILE="/usr/share/launchpad-buildd/buildd-slave.tac"
26
PIDROOT="/var/run/launchpad-buildd"
27
LOGROOT="/var/log/launchpad-buildd"
28
CONFROOT="/etc/launchpad-buildd"
30
# Gracefully exit if the package has been removed.
31
test -e $TACFILE || exit 0
34
# Function that starts a buildd slave
38
PIDFILE="$PIDROOT"/"$CONF".pid
39
LOGFILE="$LOGROOT"/"$CONF".log
40
# prior to karmic, twisted didn't support --umask, and defaulted it well.
41
# we need it to be 022, not 077.
42
case $(lsb_release -sc) in
44
[k-z]*) UMASK="--umask 022";;
46
su - buildd -c "BUILDD_SLAVE_CONFIG=$CONFROOT/$CONF PYTHONPATH=/usr/share/launchpad-buildd twistd --no_save --pidfile $PIDFILE --python $TACFILE --logfile $LOGFILE $UMASK"
50
# Function that stops a buildd slave
54
PIDFILE="$PIDROOT"/"$CONF".pid
55
test -r $PIDFILE && kill -TERM $(cat $PIDFILE) || true
58
CONFS=$(cd $CONFROOT; ls|grep -v "^-"|grep -v "~$")
62
echo -n "Starting $DESC:"
63
install -m 755 -o buildd -g buildd -d $PIDROOT
65
# Create any missing directories and chown them appropriately
66
install -d -o buildd -g buildd /home/buildd/filecache-default
68
for conf in $CONFS; do
75
echo -n "Stopping $DESC:"
76
for conf in $CONFS; do
84
# If the "reload" option is implemented, move the "force-reload"
85
# option to the "reload" entry above. If not, "force-reload" is
86
# just the same as "restart".
93
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2