cvs commit: ports/sysutils/monit/files monit.sh.in
Doug Barton
dougb at FreeBSD.org
Tue Mar 16 02:40:37 UTC 2010
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 at 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/
-------------- next part --------------
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"
More information about the cvs-all
mailing list