3 # Copyright (C) 2000-2015 Kern Sibbald
4 # License: BSD 2-Clause; see file LICENSE-FOSS
6 # bacula This shell script takes care of starting and stopping
7 # the bacula Director daemon on Debian/Ubuntu/Kubuntu
10 # Kern E. Sibbald - 21 March 2008
12 # For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@
15 # Provides: bacula-dir
16 # Required-Start: $network
17 # Required-Stop: $network
18 # Default-Start: 2 3 4 5
20 # Short-Description: Start @BACULA@ Director daemon at boot time
21 # Description: Enable @BACULA@ Director.
26 DESC="@BACULA@ Director"
27 DAEMON=@sbindir@/${NAME}
30 BOPTIONS="-c @sysconfdir@/${NAME}.conf"
33 PATH=/sbin:/bin:/usr/sbin:/usr/bin
35 test -f $DAEMON || exit 0
37 if [ -n "`getent services ${NAME}`" ]; then
38 BPORT=`getent services ${NAME} | awk '{ gsub("/tcp","",$2); print $2; }'`
41 if [ -f /etc/default/$NAME ]; then
45 PIDFILE=@piddir@/${NAME}.${BPORT}.pid
47 if [ "x${BUSER}" != "x" ]; then
48 USERGRP="--chuid ${BUSER}"
49 if [ "x${BGROUP}" != "x" ]; then
50 USERGRP="${USERGRP}:${BGROUP}"
57 echo -n "Starting ${DESC}: "
58 start-stop-daemon --start --quiet --pidfile ${PIDFILE} ${USERGRP} --exec ${DAEMON} -- ${BOPTIONS}
63 echo -n "Stopping ${DESC}: "
64 start-stop-daemon --oknodo --stop --quiet ${USERGRP} --exec ${DAEMON} -- ${BOPTIONS}
75 echo "Usage: /etc/init.d/${NAME} {start|stop|restart|force-reload}" >&2