#!/bin/sh
#
# Add the following lines to /etc/rc.conf to enable nsca:
# nsca_enable (bool):    Set to "NO" by default.
#                          Set it to "YES" to enable nsca.
# nsca_flags (str):      Set to "--single" by default.
# nsca_configfile (str): Set to "/usr/local/etc/nagios/nsca.cfg" by default.
#

. /etc/rc.subr

name="nsca"
rcvar=`set_rcvar`

command="/usr/local/libexec/nagios/nsca"
pidfile="/var/spool/nagios/nsca.lock"
nsca_user="nagios"
extra_commands="restart"

nsca_enable=${nsca_enable:-"NO"}
nsca_flags=${nsca_flags:-"--single"}
nsca_configfile=${nsca_configfile:-"/usr/local/etc/nagios/nsca.cfg"}

load_rc_config "${name}"

required_files="${nsca_configfile}"
command_args="-c ${nsca_configfile} ${nsca_flags}"

run_rc_command "$1"
