]> git.sur5r.net Git - bacula/bacula/blob - bacula/platforms/redhat/bacula-dir.in
Allow use of /lib/tls on 2.6 kernels
[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: 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 DIR_USER=@dir_user@
16 DIR_GROUP=@dir_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" -a `uname -r | cut -c1-3` = "2.4" ] ; then
21      export LD_ASSUME_KERNEL=2.4.19
22 fi
23 RETVAL=0
24 case "$1" in
25     start)
26        OPTIONS=''
27        if [ "${DIR_USER}" != '' ]; then
28           OPTIONS="${OPTIONS} -u ${DIR_USER}"
29        fi
30                                                                                    
31        if [ "${DIR_GROUP}" != '' ]; then
32           OPTIONS="${OPTIONS} -g ${DIR_GROUP}"
33        fi
34        echo -n "Starting Bacula Director services: "
35        daemon @sbindir@/bacula-dir $2 ${OPTIONS} -c @sysconfdir@/bacula-dir.conf
36        RETVAL=$?
37        echo
38        [ $RETVAL -eq 0 ] && touch @subsysdir@/bacula-dir
39        ;;
40     stop)
41        echo -n "Stopping Bacula Director services: "
42        killproc @sbindir@/bacula-dir
43        RETVAL=$?
44        echo
45        [ $RETVAL -eq 0 ] && rm -f @subsysdir@/bacula-dir
46        ;;
47     restart)
48        $0 stop
49        sleep 5
50        $0 start
51        ;;
52     status)
53        status @sbindir@/bacula-dir
54        ;;
55     *)
56        echo "Usage: $0 {start|stop|restart|status}"
57        exit 1
58        ;;
59 esac
60 exit 0