X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fplatforms%2Fdebian%2Fbacula-sd.in;h=175330475560742db4e70a31ebcb13fa0544dbe4;hb=a3014299916e5753eb7e73bb8b45ce487db7dee9;hp=4b0f712f8671a585bbba7706f03436410bbb062c;hpb=e50a81cca5ec7cacaa3c787d217ac63997fb3347;p=bacula%2Fbacula diff --git a/bacula/platforms/debian/bacula-sd.in b/bacula/platforms/debian/bacula-sd.in index 4b0f712f86..1753304755 100644 --- a/bacula/platforms/debian/bacula-sd.in +++ b/bacula/platforms/debian/bacula-sd.in @@ -9,13 +9,13 @@ # For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@ # ### BEGIN INIT INFO -# Provides: bacula-sd +# Provides: bacula-sd # Required-Start: $network # Required-Stop: $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start @BACULA@ Storage daemon at boot time -# Description: Enable @BACULA@ Storage daemon. +# Description: Enable @BACULA@ Storage daemon. ### END INIT INFO @@ -35,24 +35,30 @@ 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 - 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) @@ -65,4 +71,4 @@ case "$1" in exit 1 ;; esac -exit 0 +exit $RETVAL