Search
j0ke.net Open Build Service
>
Projects
>
server:monitoring
:
netflow
>
nprobe
> nprobe.init.rh
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File nprobe.init.rh of Package nprobe (Revision 108)
Currently displaying revision
108
,
show latest
#!/bin/sh # # chkconfig: - 50 50 # description: nprobe # ### BEGIN INIT INFO # Provides: NPROBE # Required-Start: $syslog $remote_fs $network # Should-Start: $time # Required-Stop: $syslog $remote_fs $network # Should-Stop: $null # Default-Start: 3 5 # Default-Stop: 0 1 2 6 # Short-Description: NPROBE daemon # Description: Start NPROBE ### END INIT INFO # NPROBE_BIN=/usr/bin/nprobe test -x $NPROBE_BIN || { echo "$NPROBE_BIN not installed"; if [ "$1" = "stop" ]; then exit 0; else exit 5; fi; } # Check for existence of needed config file and read it NPROBE_CONFIG=/etc/sysconfig/nprobe test -r $NPROBE_CONFIG || { echo "$NPROBE_CONFIG not existing"; if [ "$1" = "stop" ]; then exit 0; else exit 6; fi; } # Read config . $NPROBE_CONFIG # Source function library. . /etc/init.d/functions mkdir -p /var/run/nprobe/ RETVAL=0 lockfile=${LOCKFILE-/var/lock/subsys/nprobe} case "$1" in start) echo "Starting nprobe ..." if [ "${NPROBE_COLLECTORS}" == "" ] ; then NPROBE_COLLECTORS="none" fi for ADDR in ${NPROBE_COLLECTORS} ; do COLLECTOR_OPTS="${COLLECTOR_OPTS} -n ${ADDR}" done if [ "${NPROBE_ALL_COLLECTORS}" == "yes" ] ; then COLLECTOR_OPTS="${COLLECTOR_OPTS} -a" fi if [ -n "${NPROBE_NETFLOW_VERSION}" ] ; then case ${NPROBE_NETFLOW_VERSION} in 5) NF_VERSION="-V 5" ;; 9) NF_VERSION="-V 9" ;; 10) NF_VERSION="-V 10" ;; *) echo "unknown NPROBE_NETFLOW_VERSION = ${NPROBE_NETFLOW_VERSION}" echo "valid values are: 5, 9, 10 or empty" RETVAL=2 ;; esac fi if [ "${NPROBE_COLLECTOR_MODE}" == "no" ] ; then for IFACE in ${NPROBE_IFACE} ; do echo -n "instance on interface ${IFACE} " if [ "${NPROBE_USE_ZMQ}" == "no" ] ; then daemon --pidfile /var/run/nprobe/nprobe-${IFACE}.pid $NPROBE_BIN -G -g /var/run/nprobe/nprobe-${IFACE}.pid -i ${IFACE} ${NF_VERSION} ${COLLECTOR_OPTS} ${NPROBE_OPTS} RETVAL=$? elif [ "${NPROBE_USE_ZMQ}" == "yes" ] ; then daemon --pidfile /var/run/nprobe/nprobe-${IFACE}.pid $NPROBE_BIN -G -g /var/run/nprobe/nprobe-${IFACE}.pid -i ${IFACE} ${NF_VERSION} ${COLLECTOR_OPTS} ${NPROBE_OPTS} --zmq tcp://${NPROBE_ZMQ_BINDADDRESS}:${NPROBE_ZMQ_PORTBASE} RETVAL=$? NPROBE_ZMQ_PORTBASE=`expr ${NPROBE_ZMQ_PORTBASE} + 1` fi echo [ $RETVAL -eq 0 ] && touch ${lockfile}-${IFACE} done else if [ -z "${NPROBE_COLLECTOR_PORT}" ] ; then NPROBE_COLLECTOR_PORT="6661" fi if [ "${NPROBE_USE_ZMQ}" == "no" ] ; then daemon --pidfile /var/run/nprobe/nprobe.pid $NPROBE_BIN -G -g /var/run/nprobe/nprobe.pid --collector-port ${NPROBE_COLLECTOR_PORT} ${NF_VERSION} ${COLLECTOR_OPTS} ${NPROBE_OPTS} RETVAL=$? elif [ "${NPROBE_USE_ZMQ}" == "yes" ] ; then daemon --pidfile /var/run/nprobe/nprobe.pid $NPROBE_BIN -G -g /var/run/nprobe/nprobe.pid --collector-port ${NPROBE_COLLECTOR_PORT} ${NF_VERSION} ${COLLECTOR_OPTS} ${NPROBE_OPTS} --zmq tcp://${NPROBE_ZMQ_BINDADDRESS}:${NPROBE_ZMQ_PORTBASE} RETVAL=$? fi echo [ $RETVAL -eq 0 ] && touch ${lockfile} fi ;; stop) echo "Shutting down nprobe ..." if [ "${NPROBE_COLLECTOR_MODE}" == "no" ] ; then for IFACE in ${NPROBE_IFACE} ; do echo -n " instance on interface ${IFACE} " killproc -p /var/run/nprobe/nprobe-${IFACE}.pid $NPROBE_BIN RETVAL=$? echo if [ $RETVAL -eq 0 ] ; then rm -f ${lockfile}-${IFACE} ${pidfile} fi done else echo -n " " killproc -p /var/run/nprobe/nprobe.pid $NPROBE_BIN RETVAL=$? echo if [ $RETVAL -eq 0 ] ; then rm -f ${lockfile} ${pidfile} fi fi ;; try-restart|condrestart) if test "$1" = "condrestart"; then echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}" fi $0 status if test $? = 0; then $0 restart else RETVAL=0 # Not running is not a failure. fi ;; restart|force-reload|reload) $0 stop $0 start ;; status) echo "Checking for service nprobe ..." if [ "${NPROBE_COLLECTOR_MODE}" == "no" ] ; then for IFACE in ${NPROBE_IFACE} ; do echo -n "instance on interface ${IFACE} " status -p /var/run/nprobe/nprobe-${IFACE}.pid $NPROBE_BIN RETVAL=$? done else echo -n " " status -p /var/run/nprobe/nprobe.pid $NPROBE_BIN RETVAL=$? fi ;; *) echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}" RETVAL=2 ;; esac exit $RETVAL