X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fplatforms%2Fubuntu%2Fbacula-sd.in;h=e778ea961333b6f28240c3806787de45193837f6;hb=a3014299916e5753eb7e73bb8b45ce487db7dee9;hp=3a1e6b1db1190e6f4e5764330781453dbdfa1ab4;hpb=0ac68a399325d84a6602915228a87adb2166403c;p=bacula%2Fbacula diff --git a/bacula/platforms/ubuntu/bacula-sd.in b/bacula/platforms/ubuntu/bacula-sd.in index 3a1e6b1db1..e778ea9613 100644 --- a/bacula/platforms/ubuntu/bacula-sd.in +++ b/bacula/platforms/ubuntu/bacula-sd.in @@ -9,6 +9,17 @@ # For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@ # +### BEGIN INIT INFO +# Provides: bacula-sdr +# Required-Start: $local_fs $remote_fs $network $time +# Required-Stop: $local_fs $remote_fs $network $time +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Bacula Storage Daemon +# Description: Bacula is a network backup and restore program +### END INIT INFO + + NAME="bacula-sd" DESC="Bacula Storage Daemon" DAEMON=@sbindir@/${NAME} @@ -31,25 +42,31 @@ 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 + mkdir -p @piddir@ PIDFILE=@piddir@/${NAME}.${BPORT}.pid if [ "x${BUSER}" != "x" ]; then - BOPTIONS="${BOPTIONS} -u ${BUSER}" -fi -if [ "x${BGROUP}" != "x" ]; then - BOPTIONS="${BOPTIONS} -g ${BGROUP}" + 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} --exec ${DAEMON} -- ${BOPTIONS} + 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 --exec ${DAEMON} -- ${BOPTIONS} + start-stop-daemon --oknodo --stop --quiet ${USERGRP} --exec ${DAEMON} -- ${BOPTIONS} + RETVAL=$? echo "${NAME}" ;; restart|force-reload) @@ -62,4 +79,4 @@ case "$1" in exit 1 ;; esac -exit 0 +exit $RETVAL