Feature request to rc.d: managing subsets of scripts

Jon Passki cykyc at yahoo.com
Sun Aug 8 09:26:50 PDT 2004


Gratuitous self-reply :-/

--- Jon Passki <cykyc at 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 


More information about the freebsd-rc mailing list