Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Oct 2001 11:38:47 -0700 (PDT)
From:      Gordon Tetlow <gordont@gnf.org>
To:        <arch@freebsd.org>
Cc:        <kevin.way@overtone.org>
Subject:   Re: New rc.d init script roadmap
Message-ID:  <Pine.LNX.4.33.0110181126440.1612-100000@smtp.gnf.org>
In-Reply-To: <20011018112752.B20348@dragon.nuxi.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 18 Oct 2001, David O'Brien wrote:

> > > > M4
> > > > Add true dependency checking to the infrastructure so that starting nfsd
> > > > will start mountd and rpcbind
> > >
> > > The dependency checking is part of /etc/rc.d/*.  Is there something
> > > missing you have found?
> >
> > Well, once I have booted my machine, I might want to start an nfs server.
> > If I just ran /etc/rc.d/nfsd start, it would fail, because that script
> > doesn't know enought to start mountd (which in turn doesn't know enough to
> > start rpcbind). I had an idea on how to make that all work. But we need to
> > crawl before we start sprinting.
>
> Something must have been missing from your conversion of the rc.d
> scripts, because such dependancy infomation is inherent in the NetBSD
> rc.d scripts.

Here's an example (I'll use nfsd) from NetBSD:

#!/bin/sh
#
# $NetBSD: nfsd,v 1.4 2001/06/16 06:13:10 lukem Exp $
#

# PROVIDE: nfsd
# REQUIRE: mountd

. /etc/rc.subr

name="nfsd"
rcvar="nfs_server"
command="/usr/sbin/${name}"
required_vars="mountd rpcbind"

load_rc_config $name
run_rc_command "$1"

All the dependency information is coded in comments. Although, with the
required_vars there, it doesn't help to put nfs_server=YES unless you
specifically enable mountd and rpcbind, it doesn't do squat. My ultimate
goal is to be able to run /etc/rc.d/nfsd forcestart and it would start
everything that nfsd needed. I was thinking of writing the script like:


#!/bin/sh
#
# $NetBSD: nfsd,v 1.4 2001/06/16 06:13:10 lukem Exp $
#

# PROVIDE: nfsd
# REQUIRE: mountd

. /etc/rc.subr

name="nfsd"
rcvar="nfs_server"
command="/usr/sbin/${name}"

load_rc_config $name
depends_on mountd "$1"
run_rc_command "$1"

This "depends_on" function would figure out (only when starting, of
course), whether mountd is started or not, and start it if it isn't.

Does that make sense as to what I'm talking about?

-gordon


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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.33.0110181126440.1612-100000>