]> git.sur5r.net Git - bacula/bacula/blob - bacula/platforms/redhat/bacula-fd.in
Fix RH start scripts to use -u and -g if specified
[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 99
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 FD_USER=@fd_user@
16 FD_GROUP=@fd_group@
17
18 case "$1" in
19     start)
20        OPTIONS=''
21        if [ "${FD_USER}" != '' ]; then
22           OPTIONS="${OPTIONS} -u ${FD_USER}"
23        fi
24                                                                                    
25        if [ "${FD_GROUP}" != '' ]; then
26           OPTIONS="${OPTIONS} -g ${FD_GROUP}"
27        fi
28        echo -n "Starting the Bacula File daemon: "
29        daemon @sbindir@/bacula-fd $2 ${OPTIONS} -c @sysconfdir@/bacula-fd.conf
30        RETVAL=$?
31        echo
32        [ $RETVAL -eq 0 ] && touch @subsysdir@/bacula-fd
33        ;;
34     stop)
35        echo -n "Stopping the Bacula File daemon: "
36        killproc @sbindir@/bacula-fd
37        RETVAL=$?
38        echo
39        [ $RETVAL -eq 0 ] && rm -f @subsysdir@/bacula-fd
40        ;;
41     restart)
42        $0 stop
43        sleep 5
44        $0 start
45        ;;
46     status)
47        status @sbindir@/bacula-fd
48        ;;
49     *)
50        echo "Usage: $0 {start|stop|restart|status}"
51        exit 1
52        ;;
53 esac
54 exit 0