wok view ntop/stuff/etc/init.d/ntop @ rev 16646

gnome-vfs-dev: update deps
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue May 13 06:18:31 2014 +0000 (2014-05-13)
parents c3f9dd585ee1
children 7f188676b59c
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="ntop server"
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 echo "$NAME already running."
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 echo -n "Starting $DESC: $NAME... "
34 $DAEMON $OPTIONS >> $LOGFILE
35 status
36 ;;
37 stop)
38 if ! active_pidfile $PIDFILE $NAME ; then
39 echo "$NAME is not running."
40 exit 1
41 fi
42 echo -n "Stopping $DESC: $NAME... "
43 kill `cat $PIDFILE` && rm -f $PIDFILE
44 status
45 ;;
46 restart)
47 if ! active_pidfile $PIDFILE $NAME ; then
48 echo "$NAME is not running."
49 exit 1
50 fi
51 echo -n "Restarting $DESC: $NAME... "
52 kill `cat $PIDFILE` && rm -f $PIDFILE
53 sleep 2
54 $DAEMON $OPTIONS
55 status
56 ;;
57 *)
58 echo ""
59 echo -e "\033[1mUsage:\033[0m /etc/init.d/`basename $0` [start|stop|restart]"
60 echo ""
61 exit 1
62 ;;
63 esac
65 exit 0