]> git.sur5r.net Git - bacula/bacula/blob - bacula/platforms/redhat/bacula-fd.in
Change Byline
[bacula/bacula] / bacula / platforms / redhat / bacula-fd.in
1 #! /bin/sh
2 #
3 # bacula       This shell script takes care of starting and stopping
4 #              the bacula File daemon.
5 #
6 # chkconfig: 2345 91 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 FD_USER=@fd_user@
16 FD_GROUP=@fd_group@
17 FD_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 FD_OPTIONS, FD_USER, FD_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 [ "${FD_USER}" != '' ]; then
38           FD_OPTIONS="${FD_OPTIONS} -u ${FD_USER}"
39        fi
40                                                                                    
41        if [ "${FD_GROUP}" != '' ]; then
42           FD_OPTIONS="${FD_OPTIONS} -g ${FD_GROUP}"
43        fi
44        echo -n "Starting Bacula File services: "
45        daemon @sbindir@/bacula-fd $2 ${FD_OPTIONS} -c @sysconfdir@/bacula-fd.conf
46        RETVAL=$?
47        echo
48        [ $RETVAL -eq 0 ] && touch @subsysdir@/bacula-fd
49        ;;
50     stop)
51        echo -n "Stopping Bacula File services: "
52        killproc @sbindir@/bacula-fd
53        RETVAL=$?
54        echo
55        [ $RETVAL -eq 0 ] && rm -f @subsysdir@/bacula-fd
56        ;;
57     restart)
58        $0 stop
59        sleep 5
60        $0 start
61        ;;
62     status)
63        status @sbindir@/bacula-fd
64        RETVAL=$?
65        ;;
66     *)
67        echo "Usage: $0 {start|stop|restart|status}"
68        exit 1
69        ;;
70 esac
71 exit $RETVAL