Blame SOURCES/bacula-fd.init

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