Skip site navigation (1)Skip section navigation (2)
Date:      14 Jun 2001 13:42:36 +0200
From:      Cyrille Lefevre <clefevre-lists@noos.fr>
To:        Andrew Hesford <ajh3@usrlib.org>
Cc:        Gordon Tetlow <gordont@bluemtn.net>, Cyrille Lefevre <clefevre@redirect.to>, Jon Parise <jon@csh.rit.edu>, Matt Dillon <dillon@earth.backplane.com>, Will Andrews <will@physics.purdue.edu>, Warner Losh <imp@harmony.village.org>, Mark Santcroos <marks@ripe.net>, Doug Barton <DougB@DougBarton.net>, bsddiy@163.net, freebsd-hackers@FreeBSD.ORG
Subject:   Re: import NetBSD rc system
Message-ID:  <4rtjnv83.fsf@gits.dyndns.org>
In-Reply-To: <20010613202415.A3689@core.usrlib.org>
References:  <lmmvoq3r.fsf@gits.dyndns.org> <Pine.BSF.4.33.0106131750560.94127-100000@sdmail0.sd.bmarts.com> <20010613202415.A3689@core.usrlib.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Andrew Hesford <ajh3@usrlib.org> writes:

> On Wed, Jun 13, 2001 at 06:04:23PM -0700, Gordon Tetlow wrote:
[snip]
> > 
> > Anyway, here's my status:
> > rcorder ported (one line code change)

CPPFLAGS -> CFLAGS in Makefile I suppose ?

> Alternatively, give up the handy feature of being able to start services
> from their own scripts, and have a wrapper script that starts the
> specified service and satisfies dependencies. This has the distinct
> advantage of not having to call dep_check in each dependent script.
> Furthermore, it allows us to start, say, nfsd.sh, knowing full well that
> mountd is running, without worrying about some dependency checker trying
> to start a new mountd.

in fact, the require keyword isn't sufficient in it's own. there
should be pre_require and post_require keywords since nfsd needs to
start mountd before to start nfsd then rpc.statd and rpc.lockd have to
be started after nfsd.

so, you should have something like this :

in nfsd :

provide=nfsd
pre_require="portmap mountd"
post_require="statd lockd"

in mountd :

provide=nfsd
pre_require=portmap
post_require=nfsd

in statd :

provide=statd
pre_require=nfsd
post_require=

in lockd :

provide=lockd
pre_require=nfsd
post_require=

this should work sell when starting services but may cause a little
problem when stopping them. what should happen when doing nfsd stop ?
should mountd, statd and lockd stopped as well. how about portmap
which isn't only used by nfs services. so the pre_require have to
be splitted to handle this case. do you understand what I mean ?

I'm currently watching how to do this using the NetBSD rc framework.

something like this :

in rc, add this before files=`rcorder ...`

rcorder () {
        local _rc_elem _rc_provide _rc_require
        local _rc_fast_and_loose _rc_fast_run
        _rc_fast_and_loose=yes _rc_fast_run=yes
        shift 2
        for _rc_elem; do
                [ -f $_rc_elem ] || continue
                _rc_provide=$(run_rc_script $_rc_elem provide)
                for _rc_require in $(run_rc_script $_rc_elem require); do
                        echo $_etc/rc.d/$_rc_require $_etc/rc.d/$_rc_provide
                done
        done | tsort
}

in rc.subr, add the following lines in the case "$_arg" in run_rc_command

                provide)
                        echo $provide
                        return 0
                        ;;

                require)
                        echo $require
                        return 0
                        ;;

in every scripts, change # PROVIDE: and # REQUIRE: lines to variable assignment.

for instance, this isn't sufficient since all scripts have to do the
equivalent tinhgs done in the top level rc startup script to be complete.

well, I'm working on this.

Cyrille.
--
home: mailto:clefevre@redirect.to   UNIX is user-friendly; it's just particular
work: mailto:Cyrille.Lefevre@edf.fr   about who it chooses to be friends with.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




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