]> git.sur5r.net Git - bacula/bacula/blob - bacula/platforms/redhat/bacula-sd.in
Set MALLOC_CHECK_=0 in environment before starting Bacula to
[bacula/bacula] / bacula / platforms / redhat / bacula-sd.in
1 #! /bin/sh
2 #
3 # bacula       This shell script takes care of starting and stopping
4 #              the bacula Storage daemon.
5 #
6 # chkconfig: 2345 90 9
7 # description: It comes by night and sucks the vital essence from your computers.
8 #
9 #  For Bacula release @VERSION@ (@DATE@) -- @DISTNAME@
10 #
11
12 # Source function library
13 . /etc/rc.d/init.d/functions
14
15 SD_USER=@sd_user@
16 SD_GROUP=@sd_group@
17 SD_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 SD_OPTIONS, SD_USER, or SD_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 [ "${SD_USER}" != '' ]; then
38           SD_OPTIONS="${SD_OPTIONS} -u ${SD_USER}"
39        fi
40                                                                                    
41        if [ "${SD_GROUP}" != '' ]; then
42           SD_OPTIONS="${SD_OPTIONS} -g ${SD_GROUP}"
43        fi
44                                                                                       
45        echo -n "Starting Bacula Storage services: "
46        daemon @sbindir@/bacula-sd $2 ${SD_OPTIONS} -c @sysconfdir@/bacula-sd.conf
47        RETVAL=$?
48        echo
49        [ $RETVAL -eq 0 ] && touch @subsysdir@/bacula-sd
50        ;;
51     stop)
52        echo -n "Stopping Bacula Storage services: "
53        killproc @sbindir@/bacula-sd
54        RETVAL=$?
55        echo
56        [ $RETVAL -eq 0 ] && rm -f @subsysdir@/bacula-sd
57        ;;
58     restart)
59        $0 stop
60        sleep 5
61        $0 start
62        ;;
63     status)
64        status @sbindir@/bacula-sd
65        ;;
66     *)
67        echo "Usage: $0 {start|stop|restart|status}"
68        exit 1
69        ;;
70 esac
71 exit 0