From owner-svn-ports-all@FreeBSD.ORG Mon Oct 8 08:15:29 2012 Return-Path: Delivered-To: svn-ports-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 54B51106566B; Mon, 8 Oct 2012 08:15:29 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 33FCB8FC0C; Mon, 8 Oct 2012 08:15:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q988FTEo061178; Mon, 8 Oct 2012 08:15:29 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q988FTpi061175; Mon, 8 Oct 2012 08:15:29 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201210080815.q988FTpi061175@svn.freebsd.org> From: Doug Barton Date: Mon, 8 Oct 2012 08:15:28 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r305521 - in head/net-mgmt/nrpe2: . files X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Oct 2012 08:15:29 -0000 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 +# Created by: Paul Dlug # # $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"