#! /bin/sh
#
# bacula       This shell script takes care of starting and stopping
#	       the bacula File daemon.
#
# chkconfig: 2345 90 9
# description: It comes by night and sucks the vital essence from your computers.
#
#  For Bacula release 2.0.3 (06 March 2007) -- mandrake
#

# Source function library
. /etc/rc.d/init.d/functions

case "$1" in
    start)
       gprintf "Starting the Bacula File daemon: "
       daemon /usr/sbin/bacula-fd $2 -c /etc/bacula/bacula-fd.conf
       RETVAL=$?
       echo
       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/bacula-fd
       ;;
    stop)
       gprintf "Stopping the Bacula File daemon: "
       killproc /usr/sbin/bacula-fd
       RETVAL=$?
       echo
       [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/bacula-fd
       ;;
    restart)
       $0 stop
       sleep 5
       $0 start
       ;;
    status)
       status /usr/sbin/bacula-fd
       ;;
    *)
       gprintf "Usage: %s {start|stop|restart|status}\n" "$0"
       exit 1
       ;;
esac
exit 0
