Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Nov 1998 23:59:38 +0000
From:      Nik Clayton <nik@nothing-going-on.demon.co.uk>
To:        hackers@FreeBSD.ORG
Subject:   /etc/rc.d, and changes to /etc/rc?
Message-ID:  <19981115235938.22908@nothing-going-on.org>

next in thread | raw e-mail | index | archive | help
Folks,

During the day job, I use Solaris. This is not, in and of itself, a bad
thing.

Solaris uses run levels. I don't particularly like them, but I tolerate
them. I *don't* want to bring run levels (or even, if Terry's reading,
run states) to FreeBSD.

The one useful feature I've found with run [levels|states] as implemented
on Solaris is the /etc/init.d directory. For those that don't know, this
contains 'n' scripts, one per 'service', that take 'start' and 'stop'
parameters. If you want to stop Sendmail, it's 

    sh /etc/init.d/sendmail stop

No need to poke around with ps, grep, and friends to determine the PID to
kill, no wondering about whether or not there's a lock file you might 
need to clean up afterwards, and so on. It helps save a little time, and
is probably easier for newcomers to understand as well.

We already have the beginning of a system like this for ported software,
with the ${PREFIX}/etc/rc.d directory.

What are people's thoughts on doing the same thing to the base system?

In essence, this would involve (on a case by case basis) going through 
the daemons started in /etc/rc*, building a script to start/stop the
daemon, and changing the code in /etc/rc* to call these scripts instead.

NOTE: The order in which scripts would be called by /etc/rc* would not
be determined by the script name, there would be none of this silliness
with S20foo and K50bar, ordering is still determined by /etc/rc*

All I want to do is abstract out the daemon start/stop process a little
more.

Down the road, this could bring other benefits as well;

  - For those that like run levels/states, it becomes easier for them to
    create a port with a new version of init that implemented them.
    People that want run levels install the port, people that don't, don't.

  - It makes it easier to install replacements for programs that are in
    the base system. If sendmail was started from /etc/rc.d/smtp.sh,
    the first thing smtp.sh could check for is the existence of 
    /usr/local/etc/rc.d/smtp.sh, and call that instead if it existed.
    Replacing sendmail with qmail or vmailer then becomes a little easier.

  - Simplifies documentation. When explaining how to stop a system process,
    you don't need to explain ps, grep, kill, awk/cut, backticks, and
    pipelines. You just say "Do it like this", and explain the magic 
    behind it at a later point.

I realise this is a religious issue, and one of those things people like
to get all excited about. However, I've just seen a message from Jordan
suggesting the ordering be changed in host.conf, and *no one* objected.
I figured I'd jump in quickly, before they stop putting Prozac in the 
water.

N
-- 
	    C.R.F. Consulting -- we're run to make me richer. . .

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



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