Subject: Re: /etc/default
To: Greg A. Woods <firstname.lastname@example.org>
From: Simon J. Gerraty <email@example.com>
Date: 07/27/1995 10:34:43
> 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
For those running production system supporting databases and the like,
SysV run levels are quite useful, but I can live without them.
> Usually there are scripts /etc/rc0, /etc/rc2, /etc/rc3 that are invoked
These are also very neat, and a little more clever than mouse's
trivial script :-) The clever? bit is that scripts ending with .sh are
sourced into the rc script (so can affect PATH etc for later scripts)
rather than being invoked with /bin/sh.
In fact as Chris mentioned, I've done an rc.sh which I've offered to
It is a totally generic version of rcN from SysV. If invoked as
rc[0-9] it does what the SysV equivalents would do:
run all rcN.d/K scripts with arg, stop and then run all rcN.d/S
scripts with arg start.
The concept is mostly useful for rc.local, daily, weekly etc scripts.
Why? Well in my spare time, I administer about 10-20 systems right
now (mostly SunOS, but a few HP-UX and of course NetBSD machines). In
most cases I want /etc/daily to do the same things, but in certain
cases like primary DNS machines there are extra things to be done.
The daily.d concept makes this trivial to organize.
Even if you don't want to replace your rc scripts, you can have
rc.local invoke rc.sh with an arg like /etc/rc.local.d:S:start to have
it process all S scripts in /etc/rc.local.d with the arg start.
This makes it trivial to add new services at boot up etc.
I do this on some of the SunOS machines that need to run databases
etc, and /etc/shutdown is actually rc.sh so that /etc/shutdown.d/K*
can stop the database.
I made a half arsed effort to split the existing NetBSD rc scripts
into separate units, but on zen I'm really just using:
/etc/rc trivial rc script to pass autoboot
/etc/rc.d/S20rc original /etc/rc
/etc/rc.local -> /etc/rc.sh
/etc/rc.local.d/S20netbsd original /etc/rc.local
/etc/rc.local.d/S40ppp starts ppp
/etc/rc.local.d/S40runapc monitors my UPS
/etc/rc.local.d/S50wait_if waits (up to 5 min) for ppp to be up
/etc/rc.local.d/S60rdate since we have to set date from ISP
/etc/rc.local.d/S80ntp and then keep it in sync
and of course
/etc/daily.sh -> /etc/rc.sh
/etc/daily.d/S02redirect.sh redirects output
/etc/daily.d/S20daily most of the original /etc/daily
/etc/daily.d/S99mailrep.sh mails the report