]> git.sur5r.net Git - bacula/bacula/blob - bacula/platforms/ubuntu/bacula-fd.in
bweb: adjust apache conf file
[bacula/bacula] / bacula / platforms / ubuntu / bacula-fd.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 ### BEGIN INIT INFO
13 # Provides:             bacula-fd
14 # Required-Start:       $local_fs $remote_fs $network $time
15 # Required-Stop:        $local_fs $remote_fs $network $time
16 # Default-Start:        2 3 4 5
17 # Default-Stop:         0 1 6
18 # Short-Description:    Bacula File Daemon
19 # Description:          Bacula is a network backup and restore program
20 ### END INIT INFO
21
22
23 NAME="bacula-fd"
24 DESC="Bacula File Daemon"
25 DAEMON=@sbindir@/${NAME}
26 BUSER=@fd_user@
27 BGROUP=@fd_group@
28 USERGRP="-c @sysconfdir@/${NAME}.conf"
29 BPORT=@fd_port@
30
31 PATH=/sbin:/bin:/usr/sbin:/usr/bin
32
33 test -f $DAEMON || exit 0
34
35 #
36 # Disable Glibc malloc checks, it doesn't help and it keeps from getting
37 #   good dumps
38 MALLOC_CHECK_=0
39 export MALLOC_CHECK_
40
41 if [ -n "`getent services ${NAME}`" ]; then
42    BPORT=`getent services ${NAME} | awk '{ gsub("/tcp","",$2); print $2; }'`
43 fi
44
45 mkdir -p @piddir@
46 PIDFILE=@piddir@/${NAME}.${BPORT}.pid
47
48 if [ "x${BUSER}" != "x" ]; then
49    USERGRP="--chuid ${BUSER}"
50    if [ "x${BGROUP}" != "x" ]; then
51       USERGRP="${BOPTIONS}:${BGROUP}"
52    fi
53 fi
54
55 case "$1" in
56    start)
57       echo -n "Starting ${DESC}: "
58       start-stop-daemon --start --quiet --pidfile ${PIDFILE} ${USERGRP} --exec ${DAEMON}
59       RETVAL=$?
60       echo "${NAME}"
61       ;;
62    stop)
63       echo -n "Stopping ${DESC}: "
64       start-stop-daemon --oknodo --stop --quiet ${USERGRP} --exec ${DAEMON} 
65       RETVAL=$?
66       echo "${NAME}"
67       ;;
68    restart|force-reload)
69       $0 stop
70       sleep 5
71       $0 start
72       ;;
73    *)
74       echo "Usage: /etc/init.d/${NAME} {start|stop|restart|force-reload}" >&2
75       exit 1
76       ;;
77 esac
78 exit $RETVAL