Blame SOURCES/bacula-fd.init

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