#! /bin/sh # # bacula This shell script takes care of starting and stopping # the bacula Director daemon on Debian GNU Hurd systems. # # Kern E. Sibbald - 21 March 2008 # # For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@ # ### BEGIN INIT INFO # Provides: bacula-fd # Required-Start: $network # Required-Stop: $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start @BACULA@ Client daemon at boot time # Description: Enable @BACULA@ Client. ### END INIT INFO NAME="bacula-fd" DESC="@BACULA@ File Daemon" DAEMON=@sbindir@/${NAME} BUSER=@fd_user@ BGROUP=@fd_group@ BOPTIONS="-c @sysconfdir@/${NAME}.conf" BPORT=@fd_port@ PATH=/sbin:/bin:/usr/sbin:/usr/bin test -f $DAEMON || exit 0 if [ -n "`getent services ${NAME}`" ]; then BPORT=`getent services ${NAME} | awk '{ gsub("/tcp","",$2); print $2; }'` fi if [ -f /etc/default/$NAME ]; then . /etc/default/$NAME fi PIDFILE=@piddir@/${NAME}.${BPORT}.pid if [ "x${BUSER}" != "x" ]; then USERGRP="--chuid ${BUSER}" if [ "x${BGROUP}" != "x" ]; then USERGRP="${USERGRP}:${BGROUP}" fi fi case "$1" in start) echo -n "Starting ${DESC}: " start-stop-daemon --start --quiet --pidfile ${PIDFILE} ${USERGRP} --exec ${DAEMON} -- ${BOPTIONS} RETVAL=$? echo "${NAME}" ;; stop) echo -n "Stopping ${DESC}: " start-stop-daemon --oknodo --stop --quiet ${USERGRP} --exec ${DAEMON} -- ${BOPTIONS} RETVAL=$? echo "${NAME}" ;; restart|force-reload) $0 stop sleep 5 $0 start ;; *) echo "Usage: /etc/init.d/${NAME} {start|stop|restart|force-reload}" >&2 exit 1 ;; esac exit $RETVAL