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

syslinux/isohybrid.exe add -r support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Feb 14 22:06:06 2016 +0100 (2016-02-14)
parents c3f9dd585ee1
children 7f188676b59c
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@10890 16 NTOP_USER="ntop"
erjo@1463 17
erjo@10890 18 LOGFILE=/var/log/ntop/ntop.log
erjo@1463 19 PIDFILE=/var/run/ntop.pid
erjo@1463 20
erjo@10890 21 OPTIONS="-w $HTTP_PORT -L -u $NTOP_USER -d"
erjo@10890 22
erjo@1463 23 case "$1" in
erjo@1463 24 start)
pascal@11689 25 if active_pidfile $PIDFILE $NAME ; then
erjo@1463 26 echo "$NAME already running."
erjo@1463 27 exit 1
erjo@1463 28 fi
erjo@1463 29 # We need to set ntop admin password.
erjo@1463 30 if [ ! -f /var/ntop/ntop_pw.db ] ; then
erjo@1463 31 ntop -A || exit
erjo@1463 32 fi
erjo@1463 33 echo -n "Starting $DESC: $NAME... "
erjo@10890 34 $DAEMON $OPTIONS >> $LOGFILE
erjo@1463 35 status
erjo@1463 36 ;;
erjo@1463 37 stop)
pascal@11689 38 if ! active_pidfile $PIDFILE $NAME ; then
erjo@1463 39 echo "$NAME is not running."
erjo@1463 40 exit 1
erjo@1463 41 fi
erjo@1463 42 echo -n "Stopping $DESC: $NAME... "
erjo@1463 43 kill `cat $PIDFILE` && rm -f $PIDFILE
erjo@1463 44 status
erjo@1463 45 ;;
erjo@1463 46 restart)
pascal@11689 47 if ! active_pidfile $PIDFILE $NAME ; then
erjo@1463 48 echo "$NAME is not running."
erjo@1463 49 exit 1
erjo@1463 50 fi
erjo@1463 51 echo -n "Restarting $DESC: $NAME... "
erjo@1463 52 kill `cat $PIDFILE` && rm -f $PIDFILE
erjo@1463 53 sleep 2
erjo@1463 54 $DAEMON $OPTIONS
erjo@1463 55 status
erjo@1463 56 ;;
erjo@1463 57 *)
erjo@1463 58 echo ""
erjo@1463 59 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
erjo@1463 60 echo ""
erjo@1463 61 exit 1
erjo@1463 62 ;;
erjo@1463 63 esac
erjo@1463 64
erjo@1463 65 exit 0