#!/bin/sh # # chkconfig: 2345 93 83 # # description: This shell script takes care of starting and stopping ntop. # ### BEGIN INIT INFO # Provides: ntop # Required-Start: $network # Required-Stop: $network # Default-Start: 2 3 4 5 # Short-Description: Network and traffic analyzer # Description: Network and traffic analyzer ### END INIT INFO # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network prog="/usr/sbin/ntop" name=ntop # Allow extra arg . /etc/sysconfig/${name} # Check that networking is up. [ ${NETWORKING} = "no" ] && exit 0 ! [ -x $prog ] && echo $prog not found, aborting && exit 1 start () { # start daemon echo -n $"Starting $name: " #NOTE: You most likely will have to fix this up to reflect your network. # Do not run ntop until you have read the docs/1STRUN.txt file to set # the admin password! daemon $prog -d -P /var/lib/ntop -u ntop $extra_arg RETVAL=$? echo [ $RETVAL = 0 ] && touch /var/lock/subsys/ntop return $RETVAL } stop () { # stop daemon echo -n $"Stopping $name: " killproc ntop RETVAL=$? echo [ $RETVAL = 0 ] && rm -f /var/lock/subsys/ntop return $RETVAL } restart () { stop start } case "$1" in start) start ;; stop) stop ;; restart|reload) restart ;; condrestart) [ -f /var/lock/subsys/ntop ] && restart || : ;; status) status ntop ;; *) echo $"Usage: $0 {start|stop|restart|reload|condrestart|status}" exit 1 esac exit $RETVAL