#!/bin/sh # # $FreeBSD: head/net/ntopng/files/ntopng.in 507173 2019-07-22 20:40:50Z madpilot $ # # 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"