wok-next view ntop/stuff/ntop @ rev 21724

busybox: update configs
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Sep 01 11:04:25 2020 +0000 (2020-09-01)
parents d43bf7aae921
children
line source
1 #!/bin/sh
2 # /etc/init.d/ntop: Start, stop and restart ntop daemon on SliTaz,
3 # at boot time or with the command line.
4 #
5 # To start ntop server at boot time, just put the 'ntop' in the $RUN_DAEMONS
6 # variable of /etc/rcS.conf and configure options with
7 # /etc/daemons.conf.d/ntop.conf
8 #
9 . /etc/init.d/rc.functions
10 . /etc/daemons.conf.d/ntop.conf
12 NAME=ntop
13 DESC="$(_ '%s server' ntop)"
14 DAEMON=/usr/bin/ntop
15 PIDFILE=/var/run/ntop.pid
17 case "$1" in
18 start)
19 if active_pidfile $PIDFILE $NAME; then
20 _ '%s is already running.' $NAME
21 exit 1
22 fi
23 # We need to set ntop admin password. #
24 if [ ! -f /var/ntop/ntop_pw.db ]; then #
25 ntop -A || exit #
26 fi #
27 action 'Starting %s: %s...' "$DESC" $NAME
28 $DAEMON $OPTIONS >> $LOGFILE
29 status
30 ;;
31 stop)
32 if ! active_pidfile $PIDFILE $NAME; then
33 _ '%s is not running.' $NAME
34 exit 1
35 fi
36 action 'Stopping %s: %s...' "$DESC" $NAME
37 kill $(cat $PIDFILE) && rm -f $PIDFILE #
38 status
39 ;;
40 restart)
41 if ! active_pidfile $PIDFILE $NAME; then
42 _ '%s is not running.' $NAME
43 exit 1
44 fi
45 action 'Restarting %s: %s...' "$DESC" $NAME
46 kill $(cat $PIDFILE) && rm -f $PIDFILE #
47 sleep 2
48 $DAEMON $OPTIONS
49 status
50 ;;
51 *)
52 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]"
53 newline
54 exit 1
55 ;;
56 esac
58 exit 0