Blame SOURCES/bacula-sd.init

6d394f
#!/bin/sh
6d394f
#
6d394f
# bacula-sd Takes care of starting and stopping the Bacula Storage Daemon.
6d394f
#
6d394f
# chkconfig: - 80 20
6d394f
# description: The Bacula Storage Daemon is the daemon responsible for saving \
6d394f
#              backed up data on the various File Daemon to the appropriate \
6d394f
#              storage devices.
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 Storage Daemon.
6d394f
# Description: The Bacula Storage Daemon is the daemon responsible for saving
6d394f
#              backed up data on the various File Daemon to the appropriate
6d394f
#              storage devices.
6d394f
### END INIT INFO
6d394f
6d394f
# Source function library.
6d394f
. /etc/init.d/functions
6d394f
6d394f
exec="/usr/sbin/bacula-sd"
6d394f
prog="bacula-sd"
6d394f
CONFIG="/etc/bacula/bacula-sd.conf"
6d394f
OPTS="-c $CONFIG"
6d394f
6d394f
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
6d394f
6d394f
lockfile=/var/lock/subsys/$prog
6d394f
6d394f
if [ "$SD_USER" != '' ]; then
6d394f
        OPTS="$OPTS -u $SD_USER"
6d394f
fi
6d394f
6d394f
if [ "$SD_GROUP" != '' ]; then
6d394f
        OPTS="$OPTS -g $SD_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 2
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 $?