Blame SOURCES/bacula-fd.init

24b8b9
#!/bin/sh
24b8b9
#
24b8b9
# bacula-fd Takes care of starting and stopping the Bacula File Daemon.
24b8b9
#
24b8b9
# chkconfig: - 80 20
24b8b9
# description: The Bacula File Daemon is the daemon responsible for backing up \
24b8b9
#              data on the system.
24b8b9
24b8b9
### BEGIN INIT INFO
24b8b9
# Required-Start: $local_fs $network
24b8b9
# Required-Stop: $local_fs $network
24b8b9
# Default-Start: 3 4 5
24b8b9
# Default-Stop: 0 1 2 6
24b8b9
# Short-Description: Bacula File Daemon.
24b8b9
# Description: The Bacula File Daemon is the daemon responsible for backing up
24b8b9
#              data on the system.
24b8b9
### END INIT INFO
24b8b9
24b8b9
# Source function library.
24b8b9
. /etc/rc.d/init.d/functions
24b8b9
24b8b9
exec="/usr/sbin/bacula-fd"
24b8b9
prog="bacula-fd"
24b8b9
CONFIG="/etc/bacula/bacula-fd.conf"
24b8b9
OPTS="-c $CONFIG"
24b8b9
24b8b9
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
24b8b9
24b8b9
lockfile=/var/lock/subsys/$prog
24b8b9
24b8b9
if [ "$FD_USER" != '' ]; then
24b8b9
        OPTS="$OPTS -u $FD_USER"
24b8b9
fi
24b8b9
24b8b9
if [ "$FD_GROUP" != '' ]; then
24b8b9
        OPTS="$OPTS -g $FD_GROUP"
24b8b9
fi
24b8b9
24b8b9
start() {
24b8b9
    [ -x $exec ] || exit 5
24b8b9
    [ -f $config ] || exit 6
24b8b9
    echo -n $"Starting $prog: "
24b8b9
    daemon $prog $OPTS
24b8b9
    retval=$?
24b8b9
    echo
24b8b9
    [ $retval -eq 0 ] && touch $lockfile
24b8b9
    return $retval
24b8b9
}
24b8b9
24b8b9
stop() {
24b8b9
    echo -n $"Stopping $prog: "
24b8b9
    killproc $prog
24b8b9
    retval=$?
24b8b9
    echo
24b8b9
    [ $retval -eq 0 ] && rm -f $lockfile
24b8b9
    return $retval
24b8b9
}
24b8b9
24b8b9
restart() {
24b8b9
    stop
24b8b9
    sleep 1
24b8b9
    start
24b8b9
}
24b8b9
24b8b9
reload() {
24b8b9
    restart
24b8b9
}
24b8b9
24b8b9
force_reload() {
24b8b9
    restart
24b8b9
}
24b8b9
24b8b9
rh_status() {
24b8b9
    # run checks to determine if the service is running or use generic status
24b8b9
    status $prog
24b8b9
}
24b8b9
24b8b9
rh_status_q() {
24b8b9
    rh_status >/dev/null 2>&1
24b8b9
}
24b8b9
24b8b9
24b8b9
case "$1" in
24b8b9
    start)
24b8b9
        rh_status_q && exit 0
24b8b9
        $1
24b8b9
        ;;
24b8b9
    stop)
24b8b9
        rh_status_q || exit 0
24b8b9
        $1
24b8b9
        ;;
24b8b9
    restart)
24b8b9
        $1
24b8b9
        ;;
24b8b9
    reload)
24b8b9
        rh_status_q || exit 7
24b8b9
        $1
24b8b9
        ;;
24b8b9
    force-reload)
24b8b9
        force_reload
24b8b9
        ;;
24b8b9
    status)
24b8b9
        rh_status
24b8b9
        ;;
24b8b9
    condrestart|try-restart)
24b8b9
        rh_status_q || exit 0
24b8b9
        restart
24b8b9
        ;;
24b8b9
    *)
24b8b9
        echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
24b8b9
        exit 2
24b8b9
esac
24b8b9
exit $?