Blame SOURCES/bacula-dir.init

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