Blame SOURCES/bacula-dir.init

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