]> git.sur5r.net Git - bacula/bacula/blob - bacula/platforms/redhat/bacula-sd.in
Merge Otto Mueller's patch for FSH compat. Add scientific linux target.
[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 RETVAL=0
29 case "$1" in
30     start)
31        if [ "${SD_USER}" != '' ]; then
32           SD_OPTIONS="${SD_OPTIONS} -u ${SD_USER}"
33        fi
34                                                                                    
35        if [ "${SD_GROUP}" != '' ]; then
36           SD_OPTIONS="${SD_OPTIONS} -g ${SD_GROUP}"
37        fi
38                                                                                       
39        echo -n "Starting Bacula Storage services: "
40        daemon @sbindir@/bacula-sd $2 ${SD_OPTIONS} -c @sysconfdir@/bacula-sd.conf
41        RETVAL=$?
42        echo
43        [ $RETVAL -eq 0 ] && touch @subsysdir@/bacula-sd
44        ;;
45     stop)
46        echo -n "Stopping Bacula Storage services: "
47        killproc @sbindir@/bacula-sd
48        RETVAL=$?
49        echo
50        [ $RETVAL -eq 0 ] && rm -f @subsysdir@/bacula-sd
51        ;;
52     restart)
53        $0 stop
54        sleep 5
55        $0 start
56        ;;
57     status)
58        status @sbindir@/bacula-sd
59        ;;
60     *)
61        echo "Usage: $0 {start|stop|restart|status}"
62        exit 1
63        ;;
64 esac
65 exit 0