Blame SOURCES/bacula-dir.init

24b8b9
#!/bin/sh
24b8b9
#
24b8b9
# bacula-dir Takes care of starting and stopping the Bacula Director.
24b8b9
#
24b8b9
# chkconfig: - 80 20
24b8b9
# description: The Bacula Director is the daemon responsible for all the logic \
24b8b9
#              regarding the backup infrastructure: database, file retention, \
24b8b9
#              tape indexing, scheduling.
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 Director Daemon.
24b8b9
# Description: The Bacula Director is the daemon responsible for all the logic
24b8b9
#              regarding the backup infrastructure: database, file retention,
24b8b9
#              tape indexing, scheduling.
24b8b9
### END INIT INFO
24b8b9
24b8b9
# Source function library.
24b8b9
. /etc/rc.d/init.d/functions
24b8b9
24b8b9
exec="/usr/sbin/bacula-dir"
24b8b9
prog="bacula-dir"
24b8b9
CONFIG="/etc/bacula/bacula-dir.conf"
24b8b9
OPTS="-c $CONFIG"
24b8b9
24b8b9
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
24b8b9
24b8b9
lockfile=/var/lock/subsys/$prog
24b8b9
24b8b9
if [ "$DIR_USER" != '' ]; then
24b8b9
        OPTS="$OPTS -u $DIR_USER"
24b8b9
fi
24b8b9
24b8b9
if [ "$DIR_GROUP" != '' ]; then
24b8b9
        OPTS="$OPTS -g $DIR_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 $?