#!/bin/sh
#
# osad     This shell script starts the osad daemon
#
# chkconfig: - 81 04
# description: osad is a daemon used by the Spacewalk
#
### BEGIN INIT INFO
# Provides: osad
# Required-Start: $syslog $local_fs $network $remote_fs
# Required-Stop: $syslog $local_fs $network $remote_fs
# Should-Start: oracle-xe jabberd
# Should-Stop:  oracle-xe jabberd
# Default-Start:  3 5
# Default-Stop: 0 1 6
# Short-Description: This shell script starts the osad daemon
# Description:       osad is a daemon used by the Spacewalk
### END INIT INFO

# Source function library.
. /etc/rc.status

prog="osad"
script="/usr/sbin/osad"
PIDFILE="/var/run/osad.pid"

[ -f $script ] || exit 0

start() {
    # Start daemon
    echo -n "Starting $prog: "
    startproc -p $PIDFILE $script --pid-file="$PIDFILE"
    rc_status -v
}


stop() {
    # Stop daemon
    echo -n "Shutting down $prog: "
    killproc -p $PIDFILE $script
    rc_status -v
}

# See how we were called.
case "$1" in
    start)
        start
        ;;
    stop)
        stop
        ;;
    restart|reload)
        stop
        start
        ;;
    status)
        echo -n "Checking for service $prog: "
        checkproc -p $PIDFILE $script
        rc_status -v
        ;;
    condrestart|try-restart)
        $0 status
        if test $? = 0; then
            $0 restart
        else
            rc_reset
        fi
        rc_status
        ;;
    *)
        echo $"Usage: $0 {start|stop|restart|reload|status|condrestart}"
        exit 1
esac

rc_exit
