]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/platforms/debian/bacula-dir.in
Allow custom variables and checks from debian/ubuntu startup scripts
[bacula/bacula] / bacula / platforms / debian / bacula-dir.in
index 5764f8d214503a8fd130a648b39142c6d10cdb79..73253dce8e0590ff45472861a3f6c88bce4e0f4c 100644 (file)
@@ -24,7 +24,7 @@ DESC="@BACULA@ Director"
 DAEMON=@sbindir@/${NAME}
 BUSER=@dir_user@
 BGROUP=@dir_group@
-USERGRP="-c @sysconfdir@/${NAME}.conf"
+BOPTIONS="-c @sysconfdir@/${NAME}.conf"
 BPORT=@dir_port@
 
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
@@ -35,25 +35,29 @@ 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="${BOPTIONS}:${BGROUP}"
+      USERGRP="${USERGRP}:${BGROUP}"
    fi
 fi
 
 case "$1" in
    start)
       echo -n "Starting ${DESC}: "
-      start-stop-daemon --start --quiet --pidfile ${PIDFILE} ${USERGRP} --exec ${DAEMON}
+      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} 
+      start-stop-daemon --oknodo --stop --quiet ${USERGRP} --exec ${DAEMON} -- ${BOPTIONS}
       RETVAL=$?
       echo "${NAME}"
       ;;