From owner-cvs-all@FreeBSD.ORG Tue Mar 16 02:40:37 2010 Return-Path: Delivered-To: cvs-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B111E10656C1 for ; Tue, 16 Mar 2010 02:40:37 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4]) by mx1.freebsd.org (Postfix) with ESMTP id 54D1D8FC12 for ; Tue, 16 Mar 2010 02:40:37 +0000 (UTC) Received: (qmail 19971 invoked by uid 399); 16 Mar 2010 02:40:36 -0000 Received: from localhost (HELO foreign.dougb.net) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 16 Mar 2010 02:40:36 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Message-ID: <4B9EEFA3.80106@FreeBSD.org> Date: Mon, 15 Mar 2010 19:40:35 -0700 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.9.1.7) Gecko/20100218 Thunderbird/3.0.1 MIME-Version: 1.0 To: Wen Heping References: <201003160209.o2G29ieE041601@repoman.freebsd.org> In-Reply-To: <201003160209.o2G29ieE041601@repoman.freebsd.org> X-Enigmail-Version: 1.0.1 OpenPGP: id=D5B2F0FB Content-Type: multipart/mixed; boundary="------------040802020607060805060101" Cc: cvs-ports@FreeBSD.org, Martin Pala , cvs-all@FreeBSD.org, ports-committers@FreeBSD.org Subject: Re: cvs commit: ports/sysutils/monit/files monit.sh.in X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: **OBSOLETE** CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2010 02:40:37 -0000 This is a multi-part message in MIME format. --------------040802020607060805060101 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 03/15/10 19:09, Wen Heping wrote: > wen 2010-03-16 02:09:44 UTC > > FreeBSD ports repository > > Modified files: > sysutils/monit/files monit.sh.in > Log: > - Improve rc script > > PR: ports/144772 http://www.FreeBSD.org/cgi/query-pr.cgi?pr=144772 > Submitted by: Martin Pala (maintainer) > > Revision Changes Path > 1.2 +7 -5 ports/sysutils/monit/files/monit.sh.in > > http://www.FreeBSD.org/cgi/cvsweb.cgi/ports/sysutils/monit/files/monit.sh.in.diff?&r1=1.1&r2=1.2&f=h Documenting the _flags option in comments is an improvement, yes. Everything else is a pessimization; particularly since the default assignment for monit_enable is now broken. I've attached a patch that fixes the following issues: 1. General re-sorting to match conventions. 2. Change the default for _enable to the conventional method, and fix it as a side effect. Also move it down past load_rc_config. Otherwise testing for a value first is meaningless. 3. Eliminate the need for $default_config Martin, please test this and respond ASAP. Since the script as committed is now broken, it needs to be fixed. Doug -- ... and that's just a little bit of history repeating. -- Propellerheads Improve the effectiveness of your Internet presence with a domain name makeover! http://SupersetSolutions.com/ --------------040802020607060805060101 Content-Type: text/plain; name="monit.sh.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="monit.sh.diff" Index: monit.sh.in =================================================================== RCS file: /home/pcvs/ports/sysutils/monit/files/monit.sh.in,v retrieving revision 1.2 diff -u -r1.2 monit.sh.in --- monit.sh.in 16 Mar 2010 02:09:44 -0000 1.2 +++ monit.sh.in 16 Mar 2010 02:24:21 -0000 @@ -7,37 +7,37 @@ # REQUIRE: NETWORKING SERVERS # BEFORE: DAEMON # KEYWORD: shutdown - # # Add the following lines to /etc/rc.conf to enable monit: # monit_enable (bool): Set to "NO" by default. # Set it to "YES" to enable monit # monit_flags (str): Flags passed to monit on startup. # Default is "". -# -. %%RC_SUBR%% + +. /etc/rc.subr name="monit" rcvar=`set_rcvar` -restart_precmd="monit_checkconfig" -reload_precmd="monit_checkconfig" -[ -z "monit_enable" ] && monit_enable="NO" -[ -z "$monit_flags" ] && monit_flags="" - -load_rc_config $name - -default_config=%%PREFIX%%/etc/monitrc -required_files=${default_config} command="%%PREFIX%%/bin/monit" -command_args="-c ${default_config}" pidfile="/var/run/monit.pid" +extra_commands="reload" + +required_files=%%PREFIX%%/etc/monitrc +command_args="-c $required_files" + +restart_precmd="monit_checkconfig" +reload_precmd="monit_checkconfig" + monit_checkconfig() { echo "Performing sanity check on monit configuration:" ${command} ${command_args} -t } -extra_commands="reload" +load_rc_config $name + +: ${monit_enable="NO"} + run_rc_command "$1" --------------040802020607060805060101--