From owner-freebsd-current Sat Jun 15 1:23:22 2002 Delivered-To: freebsd-current@freebsd.org Received: from wantadilla.lemis.com (wantadilla.lemis.com [192.109.197.80]) by hub.freebsd.org (Postfix) with ESMTP id 5FEB337B421 for ; Sat, 15 Jun 2002 01:23:13 -0700 (PDT) Received: by wantadilla.lemis.com (Postfix, from userid 1004) id C86F981480; Sat, 15 Jun 2002 17:53:03 +0930 (CST) Date: Sat, 15 Jun 2002 17:53:03 +0930 From: Greg 'groggy' Lehey To: Mike Makonnen Cc: gordont@gnf.org, current@FreeBSD.ORG Subject: Re: HEADS UP: rc.d is in the tree Message-ID: <20020615082303.GI80429@wantadilla.lemis.com> References: <20020615011431.GG80429@wantadilla.lemis.com> <20020615003436.05e49755.makonnen@pacbell.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020615003436.05e49755.makonnen@pacbell.net> User-Agent: Mutt/1.3.99i Organization: The FreeBSD Project Phone: +61-8-8388-8286 Fax: +61-8-8388-8725 Mobile: +61-418-838-708 WWW-Home-Page: http://www.FreeBSD.org/ X-PGP-Fingerprint: 9A1B 8202 BCCE B846 F92F 09AC 22E6 F290 507A 4223 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Saturday, 15 June 2002 at 0:34:36 -0700, Mike Makonnen wrote: > On Sat, 15 Jun 2002 10:44:31 +0930 > "Greg 'groggy' Lehey" wrote: > >> On Thursday, 13 June 2002 at 15:37:55 -0700, Gordon Tetlow wrote: >>> I've imported the excellent work by Mike Makonnen into the tree. >> >> Can you summarize what the differences are? > > o Instead of a few monolithic scripts in /etc there are many task oriented > scripts in /etc/rc.d > o Dynamic ordering of boot scripts performed at boot > o Ability to run a daemon in a jailed environment as a non-privileged user > o common subroutines to make scripts shorter and easier to maintain > o If necessary, service specific knobs in /etc/rc.conf.d/ Hmm, appears to be Luke Mewburn's NetBSD stuff, which I know. Shouldn't there be an "Obtained From: NetBSD" in the commit messages? Are you (or is anybody) doing something about keeping as close as possible to being in sync with NetBSD? > > Basically, the scripts /etc/rc* scripts have been broken down into individual > scripts, each one doing one specific task**. In addition the dependency > ordering of the scripts is performed at boot time, so if you have local scripts > that you want executed at boot time, it's just a matter of writing up the script, > defining what services it should follow (i.e- after local disks have been mounted), > and then putting it > in /etc/rc.d/. There's a file: /etc/rc.subr, which is intended to make your scripts > as short as possible. It contains common subroutines that are useful in writing > scripts. Here's a quick introduction: > > #!/bin/sh > # > > . /etc/rc.subr > > # PROVIDE: fooservice > # REQUIRE: barservice mountcritlocal > # KEYWORD: FreeBSD > > name="foo" > rcvar=`set_rcvar` > command="/usr/bin/foo" > required_files="/etc/foo.conf" > > load_rc_config $name > run_rc_command "$1" > > Given this script, the routines in rc.subr will do the following: > o check rc.conf and /etc/rc.conf.d/foo to make sure 'foo_enable' is set. > o pull in the correct path to the command if 'foo_command' is specified, > and make sure it is executable > o check that the required file /etc/foo.conf exists > o pull in any command line options specified in the 'foo_flags' variable > o if the appropriate variables are defined, start foo in a jail as a non-privileged user. > o tell you whether foo is already started > o tell you what pid foo is using > o let you start foo > o let you stop all instances of foo > o and some more that I can't think of right now > > IMO the functionality you get for just those 11 lines is well worth the small effort > required in readjusting to this new scheme. If what you want to do requires > a little more customization, then you can also define custom start/stop/etc... > routines that will be executed instead of the default one. > > Having said that, there is remarkably little to adjust to. Baring any > bugs in the scripts, switching on rcng should not break anything. > I have tried to include temporary compatibility shims to ensure that. > I had intended to remove them before 5.0-RELEASE, but they should > probably be marked as deprecated and instead removed in 6.0-RELEASE. > > > Cheers, > Mike Makonnen > > ** Most scripts do one specific task, but there are exceptions. It is > acceptable to do more than one task if they are closely related: for > example: /etc/rc.d/sendmail -- See complete headers for address and phone numbers To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message