Blame SOURCES/bacula-sd.init

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