aboutsummaryrefslogtreecommitdiff
path: root/net-mgmt
diff options
context:
space:
mode:
authorDoug Barton <dougb@FreeBSD.org>2012-10-08 08:15:28 +0000
committerDoug Barton <dougb@FreeBSD.org>2012-10-08 08:15:28 +0000
commit5d043e0bd3f950142fb76d704a974f02c152ba8d (patch)
treeb0b4a322f5ce356f29e60bcc539f22e1a5384681 /net-mgmt
parentb2adb9e2d1fd3698a67e6f7478990c5650b6d479 (diff)
downloadports-5d043e0bd3f950142fb76d704a974f02c152ba8d.tar.gz
ports-5d043e0bd3f950142fb76d704a974f02c152ba8d.zip
Notes
Diffstat (limited to 'net-mgmt')
-rw-r--r--net-mgmt/nrpe2/Makefile7
-rw-r--r--net-mgmt/nrpe2/files/nrpe2.in49
2 files changed, 34 insertions, 22 deletions
diff --git a/net-mgmt/nrpe2/Makefile b/net-mgmt/nrpe2/Makefile
index 6675b911db0c..44f8bbfb1934 100644
--- a/net-mgmt/nrpe2/Makefile
+++ b/net-mgmt/nrpe2/Makefile
@@ -1,13 +1,10 @@
-# New ports collection makefile for: nrpe
-# Date created: 1 Aug 2002
-# Whom: Paul Dlug<paul@nerdlabs.com>
+# Created by: Paul Dlug<paul@nerdlabs.com>
#
# $FreeBSD$
-#
PORTNAME= nrpe
DISTVERSION= 2.13
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= net-mgmt
MASTER_SITES= SF/nagios/${PORTNAME}-2.x/${PORTNAME}-${PORTVERSION}
diff --git a/net-mgmt/nrpe2/files/nrpe2.in b/net-mgmt/nrpe2/files/nrpe2.in
index 61d861fde7d5..05d3cfc614bf 100644
--- a/net-mgmt/nrpe2/files/nrpe2.in
+++ b/net-mgmt/nrpe2/files/nrpe2.in
@@ -1,39 +1,54 @@
#!/bin/sh
-#
+
# $FreeBSD$
#
-
# PROVIDE: nrpe2
-# REQUIRE: NETWORKING
+# REQUIRE: LOGIN
# KEYWORD: shutdown
-
#
# Add the following lines to /etc/rc.conf to enable nrpe2:
# nrpe2_enable (bool): Set to "NO" by default.
# Set it to "YES" to enable nrpe2.
-# nrpe2_flags (str): Set to "" by default.
+# nrpe2_flags (str): Not set by default.
# nrpe2_configfile (str): Set to "%%PREFIX%%/etc/nrpe.cfg" by default.
-# nrpe2_pidfile (str): Set to "%%NAGIOSDIR%%/nrpe2.pid" by default.
-#
. /etc/rc.subr
-name="nrpe2"
+name=nrpe2
rcvar=nrpe2_enable
-: ${nrpe2_enable=NO}
-: ${nrpe2_configfile=%%PREFIX%%/etc/nrpe.cfg}
-pidfile=${nrpe2_pidfile:-/var/run/nrpe2/nrpe2.pid}
+load_rc_config "${name}"
+
+: ${nrpe2_enable:=NO}
+: ${nrpe2_configfile:=%%PREFIX%%/etc/nrpe.cfg}
+
+required_files="${nrpe2_configfile}"
command="%%PREFIX%%/sbin/nrpe2"
-command_args="-d"
+command_args="-c ${nrpe2_configfile} -d"
extra_commands="reload"
-start_precmd="install -d -o ${nrpe_user:-nagios} ${pidfile%/*}"
sig_reload=HUP
-load_rc_config "${name}"
-
-required_files="${nrpe2_configfile}"
-command_args="${command_args} -c ${nrpe2_configfile}"
+start_precmd=nrpe2_prestart
+stop_precmd=find_pidfile
+
+find_pidfile()
+{
+ [ -n "$nrpe2_pidfile" ] &&
+ warn "No longer necessary to set nrpe2_pidfile in rc.conf[.local]"
+
+ if type get_pidfile_from_conf >/dev/null 2>&1 &&
+ get_pidfile_from_conf pid_file %%PREFIX%%/etc/nrpe.cfg; then
+ pidfile="$_pidfile_from_conf"
+ else
+ pidfile='/var/run/nrpe2/nrpe2.pid'
+ fi
+}
+
+nrpe2_prestart()
+{
+ find_pidfile
+ install -d -o ${nrpe_user:-nagios} ${pidfile%/*}
+}
run_rc_command "$1"