diff options
author | dougb <dougb@FreeBSD.org> | 2012-10-08 16:15:28 +0800 |
---|---|---|
committer | dougb <dougb@FreeBSD.org> | 2012-10-08 16:15:28 +0800 |
commit | 10f1201978c54c4c7e9efb5565a5dcb98e0553d8 (patch) | |
tree | b0b4a322f5ce356f29e60bcc539f22e1a5384681 /net-mgmt | |
parent | cd27a0a750b28263c37e4593be1924f091b54c8d (diff) | |
download | freebsd-ports-gnome-10f1201978c54c4c7e9efb5565a5dcb98e0553d8.tar.gz freebsd-ports-gnome-10f1201978c54c4c7e9efb5565a5dcb98e0553d8.tar.zst freebsd-ports-gnome-10f1201978c54c4c7e9efb5565a5dcb98e0553d8.zip |
Fix the currently-broken rc.d script:
1. Tidy up the header
2. nrpe2 runs as an unpriviliged user, so REQUIRE: LOGIN is manadatory
3. Move load_rc_config up higher
4. Since _enable and _configfile are mandatory they should use :=
5. Only sets command_args once, and puts -d last as is traditional.
6. Pulls the pidfile from nrpe.cfg, which means it only has to be set once.
Diffstat (limited to 'net-mgmt')
-rw-r--r-- | net-mgmt/nrpe2/Makefile | 7 | ||||
-rw-r--r-- | net-mgmt/nrpe2/files/nrpe2.in | 49 |
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" |