]> git.sur5r.net Git - bacula/bacula/blob - bacula/platforms/ubuntu/bacula-sd.in
Set MALLOC_CHECK_=0 in environment before starting Bacula to
[bacula/bacula] / bacula / platforms / ubuntu / bacula-sd.in
1 #! /bin/sh
2 #
3 # bacula  This shell script takes care of starting and stopping
4 #         the bacula Director daemon on Debian/Ubuntu/Kubuntu 
5 #         systems. 
6 #
7 #   Kern E. Sibbald - 21 March 2008
8 #
9 #  For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@
10 #
11
12 NAME="bacula-sd"
13 DESC="Bacula Storage Daemon"
14 DAEMON=@sbindir@/${NAME}
15 BUSER=@sd_user@
16 BGROUP=@sd_group@
17 BOPTIONS="-c @sysconfdir@/${NAME}.conf"
18 BPORT=@sd_port@
19
20 PATH=/sbin:/bin:/usr/sbin:/usr/bin
21
22 test -f $DAEMON || exit 0
23
24 #
25 # Disable Glibc malloc checks, it doesn't help and it keeps from getting
26 #   good dumps
27 MALLOC_CHECK_=0
28 export MALLOC_CHECK_
29
30 if [ -n "`getent services ${NAME}`" ]; then
31    BPORT=`getent services ${NAME} | awk '{ gsub("/tcp","",$2); print $2; }'`
32 fi
33
34 PIDFILE=@piddir@/${NAME}.${BPORT}.pid
35
36 if [ "x${BUSER}" != "x" ]; then
37    BOPTIONS="${BOPTIONS} -u ${BUSER}"
38 fi
39 if [ "x${BGROUP}" != "x" ]; then
40    BOPTIONS="${BOPTIONS} -g ${BGROUP}"
41 fi
42
43 case "$1" in
44    start)
45       echo -n "Starting ${DESC}: "
46       start-stop-daemon --start --quiet --pidfile ${PIDFILE} --exec ${DAEMON} -- ${BOPTIONS}
47       echo "${NAME}"
48       ;;
49    stop)
50       echo -n "Stopping ${DESC}: "
51       start-stop-daemon --oknodo --stop --quiet --exec ${DAEMON} -- ${BOPTIONS}
52       echo "${NAME}"
53       ;;
54    restart|force-reload)
55       $0 stop
56       sleep 5
57       $0 start
58       ;;
59    *)
60       echo "Usage: /etc/init.d/${NAME} {start|stop|restart|force-reload}" >&2
61       exit 1
62       ;;
63 esac
64 exit 0