]> git.sur5r.net Git - bacula/bacula/blob - bacula/platforms/redhat/bacula-sd.in
30Oct04
[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 OS=`uname -s`
18
19 # if /lib/tls exists, force Bacula to use the glibc pthreads instead
20 if [ -d "/lib/tls" -a $OS = "Linux" ] ; then
21      export LD_ASSUME_KERNEL=2.4.19
22 fi
23 RETVAL=0
24 case "$1" in
25     start)
26        OPTIONS=''
27        if [ "${SD_USER}" != '' ]; then
28           OPTIONS="${OPTIONS} -u ${SD_USER}"
29        fi
30                                                                                    
31        if [ "${SD_GROUP}" != '' ]; then
32           OPTIONS="${OPTIONS} -g ${SD_GROUP}"
33        fi
34                                                                                       
35        echo -n "Starting the Bacula Storage daemon: "
36        daemon @sbindir@/bacula-sd $2 ${OPTIONS} -c @sysconfdir@/bacula-sd.conf
37        RETVAL=$?
38        echo
39        [ $RETVAL -eq 0 ] && touch @subsysdir@/bacula-sd
40        ;;
41     stop)
42        echo -n "Stopping the Bacula Storage daemon: "
43        killproc @sbindir@/bacula-sd
44        RETVAL=$?
45        echo
46        [ $RETVAL -eq 0 ] && rm -f @subsysdir@/bacula-sd
47        ;;
48     restart)
49        $0 stop
50        sleep 5
51        $0 start
52        ;;
53     status)
54        status @sbindir@/bacula-sd
55        ;;
56     *)
57        echo "Usage: $0 {start|stop|restart|status}"
58        exit 1
59        ;;
60 esac
61 exit 0