On Sat, 15 Jun 2002 10:44:31 +0930
"Greg 'groggy' Lehey" <[EMAIL PROTECTED]> 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/

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:


. /etc/rc.subr

# PROVIDE: fooservice
# REQUIRE: barservice mountcritlocal


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 
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.

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

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to