File bacula-fd.init of Package bakula

#! /bin/sh

# Copyright (c) 2005 SUSE Linux AG, Nuernberg, Germany.
# All rights reserved.


### BEGIN INIT INFO
# Provides:                     bacula-fd
# Required-Start:               $local_fs $network $remote_fs
# Required-Stop:                $local_fs $network $remote_fs
# Default-Start:                3 5
# Default-Stop:                 0 1 2 6
# Short-Description:            bacula file daemon 
# Description:                  Bacula network backup system file daemon
### END INIT INFO

# Shell functions sourced from /etc/rc.status:
#      rc_check         check and set local and overall rc status
#      rc_status        check and set local and overall rc status
#      rc_status -v     ditto but be verbose in local rc status
#      rc_status -v -r  ditto and clear the local rc status
#      rc_failed        set local and overall rc status to failed
#      rc_failed <num>  set local and overall rc status to <num><num>
#      rc_reset         clear local rc status (overall remains)
#      rc_exit          exit appropriate to overall rc status

. /etc/rc.status

BACULA_FD_BIN=/usr/sbin/bacula-fd
test -x $BACULA_FD_BIN || { echo "$BACULA_FD_BIN not installed"; 
        if [ "$1" = "stop" ]; then exit 0;
        else exit 5; fi; }


case "$1" in
    start)
        echo -n "Starting the Bacula File daemon"
        startproc -q $BACULA_FD_BIN -c /etc/bacula/bacula-fd.conf 

        rc_status -v
        ;;


    stop)
        echo -n "Shutting down the Bacula File daemon"

        killproc -TERM $BACULA_FD_BIN 

        rc_status -v
        ;;
    try-restart|condrestart)
        if test "$1" = "condrestart"; then
                echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
        fi
        $0 status
        if test $? = 0; then
                $0 restart
        else
                rc_reset
        fi
        rc_status
        ;;
    restart)
        $0 stop
        $0 start

        rc_status
        ;;
    force-reload)

        $0 try-restart
        rc_status
        ;;
    reload)
        rc_failed 3
        rc_status -v
        ;;
    status)
        echo -n "Checking for service the Bacula File daemon"
        checkproc $BACULA_FD_BIN
        rc_status -v
        ;;
    *)
        echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"
        exit 1
        ;;
esac
rc_exit