ports/net/ntopng/files/ntopng.in
Guido Falsi 8191e8e2c9 Add requirement for mysql to ntopng startup script, so that the
mysql startup script is run before it if present.

Reported by:	Daniel Engberg
2019-07-22 20:40:50 +00:00

47 lines
1 KiB
Bash

#!/bin/sh
#
# $FreeBSD$
#
# 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"