wok view 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
line source
1 #!/bin/sh
2 # /etc/init.d/ntop : Start, stop and restart ntop daemon on SliTaz, at
3 # boot time or with the command line.
4 #
5 # To start SSH server at boot time, just put ntop in the $RUN_DAEMONS
6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf
7 #
8 . /etc/init.d/rc.functions
11 NAME=ntop
12 DESC="$(_ '%s server' ntop)"
13 DAEMON=/usr/bin/ntop
15 HTTP_PORT="3000"
16 NTOP_USER="ntop"
18 LOGFILE=/var/log/ntop/ntop.log
19 PIDFILE=/var/run/ntop.pid
21 OPTIONS="-w $HTTP_PORT -L -u $NTOP_USER -d"
23 case "$1" in
24 start)
25 if active_pidfile $PIDFILE $NAME ; then
26 _ '%s is already running.' $NAME
27 exit 1
28 fi
29 # We need to set ntop admin password.
30 if [ ! -f /var/ntop/ntop_pw.db ] ; then
31 ntop -A || exit
32 fi
33 action 'Starting %s: %s...' "$DESC" $NAME
34 $DAEMON $OPTIONS >> $LOGFILE
35 status
36 ;;
37 stop)
38 if ! active_pidfile $PIDFILE $NAME ; then
39 _ '%s is not running.' $NAME
40 exit 1
41 fi
42 action 'Stopping %s: %s...' "$DESC" $NAME
43 kill $(cat $PIDFILE) && rm -f $PIDFILE
44 status
45 ;;
46 restart)
47 if ! active_pidfile $PIDFILE $NAME ; then
48 _ '%s is not running.' $NAME
49 exit 1
50 fi
51 action 'Restarting %s: %s...' "$DESC" $NAME
52 kill $(cat $PIDFILE) && rm -f $PIDFILE
53 sleep 2
54 $DAEMON $OPTIONS
55 status
56 ;;
57 *)
58 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]"
59 newline
60 exit 1
61 ;;
62 esac
64 exit 0