wok annotate ntop/stuff/etc/init.d/ntop @ rev 9897

ruby-entreprise: fix rm headers (we have i686 now not i486)
author Christophe Lincoln <pankso@slitaz.org>
date Tue May 17 11:43:54 2011 +0200 (2011-05-17)
parents
children ef7ffda1c22c
rev   line source
erjo@1463 1 #!/bin/sh
erjo@1463 2 # /etc/init.d/ntop : Start, stop and restart ntop daemon on SliTaz, at
erjo@1463 3 # boot time or with the command line.
erjo@1463 4 #
erjo@1463 5 # To start SSH server at boot time, just put ntop in the $RUN_DAEMONS
erjo@1463 6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf
erjo@1463 7 #
erjo@1463 8 . /etc/init.d/rc.functions
erjo@1463 9
erjo@1463 10
erjo@1463 11 NAME=ntop
erjo@1463 12 DESC="ntop server"
erjo@1463 13 DAEMON=/usr/bin/ntop
erjo@1463 14
erjo@1463 15 HTTP_PORT="3000"
erjo@1463 16
erjo@1463 17 OPTIONS="-w HTTP_PORT -d"
erjo@1463 18 PIDFILE=/var/run/ntop.pid
erjo@1463 19
erjo@1463 20 case "$1" in
erjo@1463 21 start)
erjo@1463 22 if [ -f $PIDFILE ] ; then
erjo@1463 23 echo "$NAME already running."
erjo@1463 24 exit 1
erjo@1463 25 fi
erjo@1463 26 # We need to set ntop admin password.
erjo@1463 27 if [ ! -f /var/ntop/ntop_pw.db ] ; then
erjo@1463 28 ntop -A || exit
erjo@1463 29 fi
erjo@1463 30 echo -n "Starting $DESC: $NAME... "
erjo@1463 31 $DAEMON $OPTIONS
erjo@1463 32 status
erjo@1463 33 ;;
erjo@1463 34 stop)
erjo@1463 35 if [ ! -f $PIDFILE ] ; then
erjo@1463 36 echo "$NAME is not running."
erjo@1463 37 exit 1
erjo@1463 38 fi
erjo@1463 39 echo -n "Stopping $DESC: $NAME... "
erjo@1463 40 kill `cat $PIDFILE` && rm -f $PIDFILE
erjo@1463 41 status
erjo@1463 42 ;;
erjo@1463 43 restart)
erjo@1463 44 if [ ! -f $PIDFILE ] ; then
erjo@1463 45 echo "$NAME is not running."
erjo@1463 46 exit 1
erjo@1463 47 fi
erjo@1463 48 echo -n "Restarting $DESC: $NAME... "
erjo@1463 49 kill `cat $PIDFILE` && rm -f $PIDFILE
erjo@1463 50 sleep 2
erjo@1463 51 $DAEMON $OPTIONS
erjo@1463 52 status
erjo@1463 53 ;;
erjo@1463 54 *)
erjo@1463 55 echo ""
erjo@1463 56 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
erjo@1463 57 echo ""
erjo@1463 58 exit 1
erjo@1463 59 ;;
erjo@1463 60 esac
erjo@1463 61
erjo@1463 62 exit 0