Date: Mon, 15 Mar 2010 19:40:35 -0700 From: Doug Barton <dougb@FreeBSD.org> To: Wen Heping <wen@FreeBSD.org> Cc: cvs-ports@FreeBSD.org, Martin Pala <martinp@tildeslash.com>, cvs-all@FreeBSD.org, ports-committers@FreeBSD.org Subject: Re: cvs commit: ports/sysutils/monit/files monit.sh.in Message-ID: <4B9EEFA3.80106@FreeBSD.org> In-Reply-To: <201003160209.o2G29ieE041601@repoman.freebsd.org> References: <201003160209.o2G29ieE041601@repoman.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <martinp@tildeslash.com> (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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4B9EEFA3.80106>