52 lines
1.0 KiB
Bash
52 lines
1.0 KiB
Bash
#!/bin/sh
|
|
|
|
# PROVIDE: nrpe
|
|
# REQUIRE: LOGIN
|
|
# KEYWORD: shutdown
|
|
#
|
|
# Add the following lines to /etc/rc.conf to enable nrpe:
|
|
# nrpe_enable (bool): Set to "NO" by default.
|
|
# Set it to "YES" to enable nrpe.
|
|
# nrpe_flags (str): Not set by default.
|
|
# nrpe_configfile (str): Set to "%%PREFIX%%/etc/nrpe.cfg" by default.
|
|
|
|
. /etc/rc.subr
|
|
|
|
name=nrpe
|
|
rcvar=nrpe_enable
|
|
|
|
load_rc_config "${name}"
|
|
|
|
: ${nrpe_enable:=NO}
|
|
: ${nrpe_configfile:=%%PREFIX%%/etc/nrpe.cfg}
|
|
|
|
required_files="${nrpe_configfile}"
|
|
|
|
command="%%PREFIX%%/sbin/nrpe"
|
|
command_args="-c ${nrpe_configfile} -d"
|
|
extra_commands=reload
|
|
sig_reload=HUP
|
|
|
|
start_precmd=nrpe_prestart
|
|
stop_precmd=find_pidfile
|
|
|
|
find_pidfile()
|
|
{
|
|
[ -n "$nrpe_pidfile" ] &&
|
|
warn "No longer necessary to set nrpe_pidfile in rc.conf[.local]"
|
|
|
|
if get_pidfile_from_conf pid_file ${nrpe_configfile}; then
|
|
pidfile="$_pidfile_from_conf"
|
|
else
|
|
pidfile='%%PIDDIR%%/nrpe.pid'
|
|
fi
|
|
}
|
|
|
|
nrpe_prestart()
|
|
{
|
|
find_pidfile
|
|
install -d -o ${nrpe_user:-nagios} ${pidfile%/*}
|
|
}
|
|
|
|
run_rc_command "$1"
|