Bacula-users

Re: [Bacula-users] problem with etc/init.d/bacula-director

2011-02-28 14:37:54
Subject: Re: [Bacula-users] problem with etc/init.d/bacula-director
From: Randy Katz <rkatz AT simplicityhosting DOT com>
To: gianni <giannife AT gmail DOT com>
Date: Mon, 28 Feb 2011 11:33:54 -0800
Here is my unaltered and working /etc/init.d/bacula-dir from ubuntu 
server 10.10 apt-get install:

# cat bacula-dir
#! /bin/sh
#
# bacula  This shell script takes care of starting and stopping
#      the bacula Director daemon on Debian/Ubuntu/Kubuntu
#      systems.
#
#   Kern E. Sibbald - 21 March 2008
#
#  For Bacula release 5.0.3 (04 August 2010) -- ubuntu
#

NAME="bacula-dir"
DESC="Bacula Director"
DAEMON=/sbin/${NAME}
BUSER=
BGROUP=
BOPTIONS="-c /etc/bacula/${NAME}.conf"
BPORT=9101

PATH=/sbin:/bin:/usr/sbin:/usr/bin

test -f $DAEMON || exit 0

#
# Disable Glibc malloc checks, it doesn't help and it keeps from getting
#   good dumps
MALLOC_CHECK_=0
export MALLOC_CHECK_

if [ -n "`getent services ${NAME}`" ]; then
    BPORT=`getent services ${NAME} | awk '{ gsub("/tcp","",$2); print 
$2; }'`
fi
mkdir -p /var/run
PIDFILE=/var/run/${NAME}.${BPORT}.pid

if [ "x${BUSER}" != "x" ]; then
    BOPTIONS="${BOPTIONS} -u ${BUSER}"
fi
if [ "x${BGROUP}" != "x" ]; then
    BOPTIONS="${BOPTIONS} -g ${BGROUP}"
fi

case "$1" in
    start)
       echo -n "Starting ${DESC}: "
       start-stop-daemon --start --quiet --pidfile ${PIDFILE} --exec 
${DAEMON} -- ${BOPTIONS}
       RETVAL=$?
       echo "${NAME}"
       ;;
    stop)
       echo -n "Stopping ${DESC}: "
       start-stop-daemon --oknodo --stop --quiet --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


On 2/28/2011 9:41 AM, gianni wrote:
> Summarinzing:
> on ubuntu 10.10 bacula-dir doesn't start automatically (there is a
> problem with the bacula-dir script in /etc/init.d), could you please
> tell me how to modify this standard script, taken from the bacula
> source?
> I wrote the values that I think are correct in the comments, the rest
> of the script is inaltered.
>
> thanks
>
> #! /bin/sh
> #
> # bacula  This shell script takes care of starting and stopping
> #       the bacula Director daemon on Debian/Ubuntu/Kubuntu
> #       systems.
> #
> #   Kern E. Sibbald - 21 March 2008
> #
> #  For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@
> #
>
> NAME="bacula-dir"
> DESC="Bacula Director"
> # I would use
> #DAEMON= /usr/sbin/${NAME}
> DAEMON=@sbindir@/${NAME}
> # I would use
> #BUSER=bacula
> BUSER=@dir_user@
> # I would use
> #BGROUP=bacula
> BGROUP=@dir_group@
> # I would use
> #BOPTIONS="-c /etc/bacula/${NAME}.conf"
> BOPTIONS="-c @sysconfdir@/${NAME}.conf"
> # 9101?
> BPORT=@dir_port@
>
> PATH=/sbin:/bin:/usr/sbin:/usr/bin
>
> test -f $DAEMON || exit 0
>
> #
> # Disable Glibc malloc checks, it doesn't help and it keeps from getting
> #   good dumps
> MALLOC_CHECK_=0
> export MALLOC_CHECK_
>
> if [ -n "`getent services ${NAME}`" ]; then
>     BPORT=`getent services ${NAME} | awk '{ gsub("/tcp","",$2); print $2; }'`
> fi
>
> # is piddir= /var/run/bacula?
> 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}"
> fi
>
> case "$1" in
>     start)
>        echo -n "Starting ${DESC}: "
>        start-stop-daemon --start --quiet --pidfile ${PIDFILE} --exec
> ${DAEMON} -- ${BOPTIONS}
>        RETVAL=$?
>        echo "${NAME}"
>        ;;
>     stop)
>        echo -n "Stopping ${DESC}: "
>        start-stop-daemon --oknodo --stop --quiet --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
>
> ------------------------------------------------------------------------------
> Free Software Download: Index, Search&  Analyze Logs and other IT data in
> Real-Time with Splunk. Collect, index and harness all the fast moving IT data
> generated by your applications, servers and devices whether physical, virtual
> or in the cloud. Deliver compliance at lower cost and gain new business
> insights. http://p.sf.net/sfu/splunk-dev2dev
> _______________________________________________
> Bacula-users mailing list
> Bacula-users AT lists.sourceforge DOT net
> https://lists.sourceforge.net/lists/listinfo/bacula-users
>


------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users