5
# Required-Start: $local_fs $network $remote_fs
6
# Required-Stop: $local_fs $network $remote_fs
7
# Should-Start: schroot
9
# Default-Start: 2 3 4 5
11
# Short-Description: Debian package autobuilder daemon
12
# Description: Control the buildd daemon.
15
# Copyright © 2006-2009 Roger Leigh <rleigh@debian.org>
16
# Copyright © 2007 Federico Di Gregorio <fog@debian.org>
18
# sbuild is free software: you can redistribute it and/or modify it
19
# under the terms of the GNU General Public License as published by
20
# the Free Software Foundation, either version 3 of the License, or
21
# (at your option) any later version.
23
# sbuild is distributed in the hope that it will be useful, but
24
# WITHOUT ANY WARRANTY; without even the implied warranty of
25
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26
# General Public License for more details.
28
# You should have received a copy of the GNU General Public License
29
# along with this program. If not, see
30
# <http://www.gnu.org/licenses/>.
32
DAEMON=/usr/bin/buildd
33
PIDFILE=/var/lib/buildd/build/buildd.pid
34
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
36
DESC="Debian package autobuilder"
38
. /lib/lsb/init-functions
40
test -x $BUILDD || exit 0
41
test -x $BUILDD_WATCHER || exit 0
43
# Include buildd defaults if available
44
if [ -f "/etc/default/$NAME" ] ; then
45
. "/etc/default/$NAME"
51
log_begin_msg "Starting $DESC: $NAME "
53
if [ -e /var/lib/buildd/NO-DAEMON-PLEASE ]; then
54
log_failure_msg "NO-DAEMON-PLEASE exists, not starting"
56
start-stop-daemon --start --quiet --oknodo --pidfile "$PIDFILE" --chuid buildd:buildd --exec $DAEMON
63
log_begin_msg "Stopping $DESC: $NAME"
65
start-stop-daemon --stop --quiet --retry 5 --oknodo --pidfile $PIDFILE --name $NAME
71
log_begin_msg "Reloading $DESC: $NAME"
72
start-stop-daemon --stop --quiet --pidfile $PIDFILE --name $NAME --signal USR1 && success=1
77
log_begin_msg "Restarting $DESC: $NAME "
78
if start-stop-daemon --stop --quiet --retry 5 --oknodo --pidfile $PIDFILE --name $NAME; then
79
if [ -e /var/lib/buildd/NO-DAEMON-PLEASE ]; then
80
log_failure_msg "NO-DAEMON-PLEASE exists, not starting"
82
start-stop-daemon --start --quiet --pidfile "$PIDFILE" --chuid buildd:buildd --exec $DAEMON
102
echo -n "Status of $DESC: "
103
if [ ! -r "$PIDFILE" ]; then
104
echo "$NAME is not running."
107
if read pid < "$PIDFILE" && ps -p "$pid" > /dev/null 2>&1; then
108
echo "$NAME is running."
111
echo "$NAME is not running but $PIDFILE exists."
117
echo "Usage: $N {start|stop|restart|force-reload|status}" >&2