@@ -111,21 +111,25 @@
## Start daemon with startproc(8). If this fails
## the return value is set appropriately by startproc.
for IFACE in ${NTOPNG_IFACE} ; do
- IFACEN=${IFACE}
- if [ -n "`echo ${IFACE} | grep -i ^tcp`" ] ; then
- idx=0
- PORT=`echo ${IFACE} | awk -F: '{print $NF}'`
- if [ -n "${PORT}" ] ; then
- IFACE="zmq_${PORT}"
- else
- IFACE="zmq_${idx}"
- idx=`expr ${idx} + 1`
- fi
- fi
+ IFACEN=${IFACE}
+ if [ -n "`echo ${IFACE} | grep -i ^tcp`" ] ; then
+ idx=0
+ PORT=`echo ${IFACE} | awk -F: '{print $NF}'`
+ if [ "${idx}" == "0" ] ; then
+ if [ -n "${PORT}" ] ; then
+ IFACE="zmq_${PORT}"
+ idx=`expr ${idx} + 1`
+ else
+ IFACE="zmq_${idx}"
+ idx=`expr ${idx} + 1`
+ fi
+ fi
+ fi
+ IFACEOPT="${IFACEOPT} -i ${IFACEN}"
+ done
echo -n "instance on interface ${IFACE} "
- /sbin/startproc -p /var/run/ntopng/ntopng-${IFACE}.pid $NTOPNG_BIN -i ${IFACEN} -G /var/run/ntopng/ntopng-${IFACE}.pid ${NTOPNG_OPTS}
+ /sbin/startproc -p /var/run/ntopng/ntopng-${IFACE}.pid $NTOPNG_BIN ${IFACEOPT} -G /var/run/ntopng/ntopng-${IFACE}.pid ${NTOPNG_OPTS}
rc_status -v
- done
;;
stop)
echo "Shutting down ntopng ..."
@@ -177,40 +181,46 @@
# NOTE: checkproc returns LSB compliant status values.
for IFACE in ${NTOPNG_IFACE} ; do
- IFACEN=${IFACE}
- if [ -n "`echo ${IFACE} | grep -i ^tcp`" ] ; then
- idx=0
- PORT=`echo ${IFACE} | awk -F: '{print $NF}'`
- if [ -n "${PORT}" ] ; then
- IFACE="zmq_${PORT}"
- else
- IFACE="zmq_${idx}"
- idx=`expr ${idx} + 1`
+ IFACEN=${IFACE}
+ if [ -n "`echo ${IFACE} | grep -i ^tcp`" ] ; then
+ idx=0
+ PORT=`echo ${IFACE} | awk -F: '{print $NF}'`
+ if [ "${idx}" == "0" ] ; then
+ if [ -n "${PORT}" ] ; then
+ IFACE="zmq_${PORT}"
+ idx=`expr ${idx} + 1`
+ else
+ IFACE="zmq_${idx}"
+ idx=`expr ${idx} + 1`
+ fi
+ fi
fi
- fi
+ done
echo -n "instance on interface ${IFACE} "
/sbin/checkproc -p /var/run/ntopng/ntopng-${IFACE}.pid $NTOPNG_BIN
rc_status -v
- done
;;
probe)
## Optional: Probe for the necessity of a reload, print out the
## argument to this init script which is required for a reload.
## Note: probe is not (yet) part of LSB (as of 1.9)
for IFACE in ${NTOPNG_IFACE} ; do
- IFACEN=${IFACE}
- if [ -n "`echo ${IFACE} | grep -i ^tcp`" ] ; then
- idx=0
- PORT=`echo ${IFACE} | awk -F: '{print $NF}'`
- if [ -n "${PORT}" ] ; then
- IFACE="zmq_${PORT}"
- else
- IFACE="zmq_${idx}"
- idx=`expr ${idx} + 1`
+ IFACEN=${IFACE}
+ if [ -n "`echo ${IFACE} | grep -i ^tcp`" ] ; then
+ idx=0
+ PORT=`echo ${IFACE} | awk -F: '{print $NF}'`
+ if [ "${idx}" == "0" ] ; then
+ if [ -n "${PORT}" ] ; then
+ IFACE="zmq_${PORT}"
+ idx=`expr ${idx} + 1`
+ else
+ IFACE="zmq_${idx}"
+ idx=`expr ${idx} + 1`
+ fi
+ fi
fi
- fi
- test /etc/sysconfig/ntopng -nt /var/run/ntopng/ntopng-${IFACE}.pid && echo reload
done
+ test /etc/sysconfig/ntopng -nt /var/run/ntopng/ntopng-${IFACE}.pid && echo reload
;;
*)
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
|