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

Up coreutils(8.25)
author Aleksej Bobylev <al.bobylev@gmail.com>
date Wed Jun 15 17:23:11 2016 +0300 (2016-06-15)
parents ba5507fa22f8
children
rev   line source
erjo@1463 1 #!/bin/sh
al@19159 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
al@19159 12 DESC="$(_ '%s server' ntop)"
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
al@19159 26 _ '%s is already running.' $NAME
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
al@19159 31 ntop -A || exit
erjo@1463 32 fi
al@19159 33 action 'Starting %s: %s...' "$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
al@19159 39 _ '%s is not running.' $NAME
erjo@1463 40 exit 1
erjo@1463 41 fi
al@19159 42 action 'Stopping %s: %s...' "$DESC" $NAME
al@19159 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
al@19159 48 _ '%s is not running.' $NAME
erjo@1463 49 exit 1
erjo@1463 50 fi
al@19159 51 action 'Restarting %s: %s...' "$DESC" $NAME
al@19159 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 *)
al@19159 58 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]"
al@19159 59 newline
erjo@1463 60 exit 1
erjo@1463 61 ;;
erjo@1463 62 esac
erjo@1463 63
erjo@1463 64 exit 0