Subject: Re: /etc/default
To: Ken Hornstein <kenh@cmf.nrl.navy.mil>
From: Greg A. Woods <woods@kuma.web.net>
List: current-users
Date: 07/26/1995 17:52:51
[ On Tue, July 25, 1995 at 21:57:41 (-0400), Ken Hornstein wrote: ]
> Subject: Re: /etc/default 
>
> does it copy the right config files to the right locations, or does the
> system magically "know" which runlevel it's at and what to do for each case?
> (On those systems that I used to administer that had runlevels, I basically
> ignored them - I never found the need for them, so I don't know much about
> them).

There's nothing magic about run levels.  They're just a way to extend
the system's default run states from two to many.

A simple control file (/etc/inittab) says what to do in each state (or
rather on each state transition), and the rest is implemented by simple
scripts.  I.e. take the old /etc/ttys concept to the n'th degree, and
there you have it.

On an AT&T SysVr3/r4 box there are 6 states defined by default:

	0: shutdown
	1: go to single user mode
	2: go to multi-user mode
	3: turn on networking
	4: un-defined
	5: go to firmware
	6: reboot

There are also some pseudo-states that are used to control system
initialisation just after boot.

Usually there are scripts /etc/rc0, /etc/rc2, /etc/rc3 that are invoked
with the correct options by lines in /etc/inittab to manage the
transition between these states, and final control over the kernel is
done with a command that's essentially a combination of reboot and halt
(/etc/uadmin, which can halt, reboot, switch to monitor, sync the disks,
re-mount /dev/root, etc.).

It truely is quite simple and elegant, and the flexibility is enormous.

On most commercial systems I configured and/or administered I defined
state 4 to be a "maintenance" mode where all the filesystems are
mounted, networking is running, but services like mail, cron, user
logins, etc., are all disabled.  It makes doing backups, installing
software, running tests, etc., quite simple and easy.  We've also used
level 4 to implement safe automated backups.  A cron script simply trips
the system into level 4, and when the backups are done, it re-starts
everything simply and safely (i.e. automated maintenance mode!).

Naturally almost anything can be done with the run-level concept, and it
would be trivial to replace a BSD init with a SysV one and write a
simple /etc/inittab that mimics the behaviour of the BSD init.

Should we start up a discussion of the SysVr4 sysmon tools in this same
breath?  ;-)

-- 
							Greg A. Woods

+1 416 443-1734			VE3TCP			robohack!woods
Planix, Inc. <woods@planix.com>; Secrets Of The Weird <woods@weird.com>