]> git.sur5r.net Git - bacula/bacula/blob - bacula/platforms/redhat/bacula-dir.in
06038560eaa64bbbb95deb9b559eeb7db8320d40
[bacula/bacula] / bacula / platforms / redhat / bacula-dir.in
1 #! /bin/sh
2 #
3 # bacula       This shell script takes care of starting and stopping
4 #              the bacula Director daemon
5 #
6 # chkconfig: 2345 92 9
7 # description: The Leading Open Source Backup Solution.
8 #
9 #  For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@
10 #
11
12 # Source function library
13 . /etc/rc.d/init.d/functions
14
15 DIR_USER=@dir_user@
16 DIR_GROUP=@dir_group@
17 DIR_OPTIONS=''
18 OS=`uname -s`
19
20 # if /lib/tls exists, force Bacula to use the glibc pthreads instead
21 if [ -d "/lib/tls" -a $OS = "Linux" -a `uname -r | cut -c1-3` = "2.4" ] ; then
22      export LD_ASSUME_KERNEL=2.4.19
23 fi
24
25 # pull in any user defined DIR_DIR_OPTIONS, DIR_USER, or DIR_GROUP
26 [ -f /etc/sysconfig/bacula ] && . /etc/sysconfig/bacula
27
28 #
29 # Disable Glibc malloc checks, it doesn't help and it keeps from getting
30 #   good dumps
31 MALLOC_CHECK_=0
32 export MALLOC_CHECK_
33
34 RETVAL=0
35 case "$1" in
36     start)
37        if [ "${DIR_USER}" != '' ]; then
38           DIR_OPTIONS="${DIR_OPTIONS} -u ${DIR_USER}"
39        fi
40                                                                                    
41        if [ "${DIR_GROUP}" != '' ]; then
42           DIR_OPTIONS="${DIR_OPTIONS} -g ${DIR_GROUP}"
43        fi
44        echo -n "Starting Bacula Director services: "
45        daemon @sbindir@/bacula-dir $2 ${DIR_OPTIONS} -c @sysconfdir@/bacula-dir.conf
46        RETVAL=$?
47        echo
48        [ $RETVAL -eq 0 ] && touch @subsysdir@/bacula-dir
49        ;;
50     stop)
51        echo -n "Stopping Bacula Director services: "
52        killproc @sbindir@/bacula-dir
53        RETVAL=$?
54        echo
55        [ $RETVAL -eq 0 ] && rm -f @subsysdir@/bacula-dir
56        ;;
57     restart)
58        $0 stop
59        sleep 5
60        $0 start
61        ;;
62     status)
63        status @sbindir@/bacula-dir
64        RETVAL=$?
65        ;;
66     *)
67        echo "Usage: $0 {start|stop|restart|status}"
68        exit 1
69        ;;
70 esac
71 exit $RETVAL