view wflogs-daemon.rc.in @ 2:400b1de6e1c6

allow multiple config contexts
author Carl Byington <carl@five-ten-sg.com>
date Fri, 17 May 2013 10:32:12 -0700
parents 0aa1171aebd2
children
line wrap: on
line source

#!@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