Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Aug 2004 09:26:48 -0700 (PDT)
From:      Jon Passki <cykyc@yahoo.com>
To:        freebsd-rc@freebsd.org
Subject:   Re: Feature request to rc.d: managing subsets of scripts
Message-ID:  <20040808162649.80859.qmail@web50302.mail.yahoo.com>
In-Reply-To: <20040807214302.73783.qmail@web50307.mail.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Gratuitous self-reply :-/

--- Jon Passki <cykyc@yahoo.com> wrote:

> Hello All,
> 
> I wish accomplish the following with rc.d scripts:
> 
> 1) Scripts can be assigned to a subset;
> 2) Subsets can be ordered, with this order honored by rcorder;
> 3) Subsets can be independently started and stopped after the
> initial system startup;
> 
> For me, the usage would be in situations where I have a bunch of
> interdependent scripts that would need a stop/start when for
> example I'm remounting a file system or reassigning daemons to a
> different network interface.  This way, I could assign scripts to
> subsets if I know that they utilize common interfaces or mounts. 
> It is implied that if a script wasn't placed in a subset it
> should
> continue to function even though it may depend on or be a
> dependent
> of a subset that was stopped.  It is the responsibility of the
> sysadmin to properly segment subsets.
> 
> 1) & 2) can be accomplished with the REQUIRE, PROVIDE and BEFORE
> lines.  This would also make me alter each rc.d script I wish to
> manage, but that is acceptable.  It's unknown to me if subsets
> should be disjointed.
> 
> It isn't obvious to me, though, if 3) could work that way.  I
> still
> would see rcorder doing it's magic, but it would need a filter to
> only order that subset.  The KEYWORD line could be used in
> addition
> to the other lines, but adds some redundancy.  According to  [1],
> rcorder logically OR's keep list switches.  It would have to AND
> them in this case to handle a) the FreeBSD switch and b) more
> importantly, manage more than one subset.

snippit for 3)

subsets="zone1 internal external"

for _i in ${subsets}
do
        if [ -z "${_regexp}" ]; then
                 _regexp="'^# KEYWORDS?:.*${_i}"
        else
                _regexp="${_regexp}|^# KEYWORDS?:.*${_i}"
        fi
done
_files=`eval "grep -El ${_regexp}' ${some_path}"`
rcorder ${skip} ${_files} 2>/dev/null

Thanks to Oliver Eikemeier for the KEYWORD string :-)

Jon Passki

p.s. This satisfies things for me.  YMMV




	
		
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040808162649.80859.qmail>