#!@BASH@
#
# wflogs-daemon   This script controls the wflogs-daemon daemon.
#
#
# chkconfig: 2345 60 40
# description: wflogs-daemon monitors syslog files, feeds pieces to wflogs
# processname: wflogs-daemon
# pidfile: /var/run/wflogs-daemon.pid
# Source function library.
#
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

RETVAL=0
# See how we were called.
case "$1" in
    start)
        # Start daemons.
        echo -n "Starting wflogs-daemon: "
        if [ ! -f /var/lock/subsys/wflogs-daemon ]; then
            cd SYSCONFDIR   # conf file is here
            SBINDIR/wflogs-daemon -d 3
            RETVAL=$?
            pid=`pidof -s SBINDIR/wflogs-daemon`
            if [ $pid ]
            then
                success "Starting wflogs-daemon :"
                touch /var/lock/subsys/wflogs-daemon
                echo
            else
                failure "Starting wflogs-daemon:"
                echo
            fi
        else
            echo -n "already running! "
            failure "wflogs-daemon already running!"
            echo
        fi

        ;;
    stop)
        # Stop daemons.
        echo -n "Shutting down wflogs-daemon: "
        killproc wflogs-daemon
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/wflogs-daemon
        ;;
    restart|reload)
        $0 stop
        $0 start
        RETVAL=$?
        ;;
    status)
        status wflogs-daemon
        RETVAL=$?
        ;;
    *)
        echo "Usage: wflogs-daemon {start|stop|restart|reload|status}"
        exit 1
esac
exit $RETVAL
