aboutsummaryrefslogtreecommitdiff
path: root/net/ntopng/files/ntopng.in
blob: 462f0a3f0603bc5e6da55e63cd1d5077d2829451 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/sh

# PROVIDE: ntopng
# REQUIRE: LOGIN netif mysql
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable ntopng:
#
# ntopng_enable (bool):		Set it to "YES" to enable ntopng
#				Default is "NO".
# ntopng_flags (flags):		Set extra flags to ntopng
#				Empty by default.
# ntopng_pidfile (path):	Path to the pidfile
#				Default /var/run/ntopng/ntopng.pid
#

. /etc/rc.subr

name=ntopng
desc="Monitors network traffic in realtime"
rcvar=ntopng_enable

load_rc_config $name

: ${ntopng_enable:=NO}
: ${ntopng_pidfile:=/var/run/ntopng/ntopng.pid}

httpdocs_path=%%DATADIR%%/httpdocs
scripts_path=%%DATADIR%%/scripts
callbacks_path=%%DATADIR%%/scripts/callbacks
user_path=%%PREFIX%%/etc/ntopng-users.conf

start_precmd=ntopng_precmd
command=%%PREFIX%%/bin/ntopng
command_args="-U ntopng -G ${ntopng_pidfile} -1 ${httpdocs_path} -2 ${scripts_path} -3 ${callbacks_path} -e"

ntopng_precmd()
{
	local rundir=${ntopng_pidfile%/*}
	if [ ! -d $rundir ] ; then
		install -d -m 0755 -o ntopng -g ntopng $rundir
	fi
}

run_rc_command "$1"