Date: Mon, 8 Oct 2012 08:15:28 +0000 (UTC) From: Doug Barton <dougb@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r305521 - in head/net-mgmt/nrpe2: . files Message-ID: <201210080815.q988FTpi061175@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: dougb Date: Mon Oct 8 08:15:28 2012 New Revision: 305521 URL: http://svn.freebsd.org/changeset/ports/305521 Log: 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. Modified: head/net-mgmt/nrpe2/Makefile head/net-mgmt/nrpe2/files/nrpe2.in Modified: head/net-mgmt/nrpe2/Makefile ============================================================================== --- head/net-mgmt/nrpe2/Makefile Mon Oct 8 08:13:05 2012 (r305520) +++ head/net-mgmt/nrpe2/Makefile Mon Oct 8 08:15:28 2012 (r305521) @@ -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} Modified: head/net-mgmt/nrpe2/files/nrpe2.in ============================================================================== --- head/net-mgmt/nrpe2/files/nrpe2.in Mon Oct 8 08:13:05 2012 (r305520) +++ head/net-mgmt/nrpe2/files/nrpe2.in Mon Oct 8 08:15:28 2012 (r305521) @@ -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}" +start_precmd=nrpe2_prestart +stop_precmd=find_pidfile -required_files="${nrpe2_configfile}" -command_args="${command_args} -c ${nrpe2_configfile}" +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"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210080815.q988FTpi061175>