Blame SOURCES/bacula-sd.init

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