Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > 6d209156c096dbacafbbb06800c7f9d1 > files > 11

ntop-3.4-0.2.pre3.fc14.src.rpm

#!/bin/bash
#
# Startup script for the ntop program

# chkconfig: - 81 19
# description: A network traffic probe similar to the UNIX top command
# processname: ntop
# pidfile: /var/run/ntop.pid
# config: /etc/ntop.conf
#
### BEGIN INIT INFO
# Provides:          ntop
# Required-Start:    $local_fs $network $syslog
# Should-Start:
# Required-Stop:
# Default-Stop:      0 1 2 6
# Short-Description: Start ntop daemon
# Description:       Start ntop, a network traffic probe similar to the UNIX \
#                    top command
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

# Path to the ntop program
prog=ntop
ntop=/usr/sbin/$prog
pidfile=/var/run/$prog.pid
config=/etc/ntop.conf
 

start() {
    echo -n $"Starting $prog: "

    [ -x $ntop ] || exit 1
    [ -r "/etc/ntop.conf" ] || exit 6
    if [ ! -r "/var/lib/ntop/ntop_pw.db" ]; then
      echo "service not configured, run ntop manually"
      exit 6
    fi

    # ntop has string errors in locales other than "C"
    LANG=C daemon "$ntop @$config --daemon > /dev/null" 
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
    return $RETVAL
}
stop() {
    echo -n $"Stopping $prog: "
    killproc -p $pidfile $ntop
    RETVAL="$?"
    echo
    [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog $pidfile
}
reload() {
    echo -n $"Reloading $prog: "
    killproc $ntop -HUP
    RETVAL=$?
    echo
}

case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  status)
    status $ntop
    RETVAL=$?
    ;;
  restart)
    stop
    start
    RETVAL=$?
    ;;
  condrestart)
    if [ -f /var/run/$prog.pid ] ; then
        stop
        start
    fi
    RETVAL=$?
    ;;
  reload)
    reload
    ;;
  *)
    echo $"Usage: $prog {start|stop|restart|condrestart|reload|status}"
    RETVAL=3
esac

exit $RETVAL