Blame SOURCES/bacula-sd.init

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