Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Jan 2002 03:12:55 +0000 (GMT)
From:      =?iso-8859-1?q?Matt=20Sykes?= <mattmsykes@yahoo.co.uk>
To:        freebsd-questions@freebsd.org
Subject:   BSD init and services
Message-ID:  <20020107031255.37396.qmail@web21008.mail.yahoo.com>

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


There are a couple inconsistencies in FreeBSD's init/services setup
which have always annoyed me.  I will outline my qualms and my
solutions to them if you would induge me.

Let me preface by saying I am not asking for a sysv init system.  I
understand the benefits of rc.conf and mostly agree with the BSD-init
philosophy.

But I wish for a systematic, standard method for starting/stopping
(and/or suspending/reloading) services.  The method used to
start/stop
sshd should be the same method used to start/stop apache.  But
currently these methods are entirely different for the arbitrary
reason that sshd has been blessed into the base system.

To kill sshd, I need to either 'killall sshd' or 'ps aux | grep sshd'
and find the pid I wish to kill.  To kill apache, just
'/usr/local/etc/rc.d/apache.sh stop'.  To start sshd, --- well I
don't
know how to do that systematically; I guess I would look at
sshd_flags
in rc.conf or defaults/rc.conf and start it manually with those
flags,
making sure sshd_program is the same.  To start apache, simply
'/usr/local/etc/rc.d/apahce.sh start'.

Now if I want to start (or restart) network services, there is yet
another entirely different method to do that, /etc/netstart.  And if
I
want to *stop* network services, I guess I have to do that manually
(i.e., unsystematically).

All this seems ad hoc and therefore unsatisfactory to me.

As a solution, my first thought was to make /etc/rc eventually call
'/usr/local/etc/rc.d/sshd.sh start' when ssh_enable=YES in rc.conf.
However this is undesirable because then sshd would already be in
line
to be started up with the other (executable, ending in .sh) scripts
in
/usr/local/etc/rc.d.  We could make a special case for sshd along
with
the other base services, but this would be an inconsistency worse
than
the inconsistency at present.  Also, since sshd is part of the base,
it should not appear in /usr/local anyway.

My next thought was to make /etc/rc eventually call
'/etc/rc.d/sshd.sh
start' when sshd_enable=YES in rc.conf; that is, base services would
go into /etc/rc.d, following the same style as /usr/local/etc/rc.d.

But /etc/rc would not start all scripts in /etc/rc.d as with
/usr/local/etc/rc.d.  It would just be something to which /etc/rc
refers.  That is, the rc.conf we all know and love would remain
unchanged in appearance and functionality.  After all, BSD people
like
their configuration described plainly in a single file, not in
symbolic links and execute bits.

At this point we have base and local services treated the same but
located in different places; base services in /etc/rc.d and local
services in /usr/local/etc/rc.d.

If the user really wants absolute consistency between base and local
services, he/she can 'ln -s /usr/local/etc/rc.d/*.sh /etc/rc.d' or
even do this in a startup script.  In this case the symlinks act as
reminder of what is base and what is local.  (You now have an
inconsistency because local things are outside of /usr/local, but
whatever.)  Note it wouldn't make sense to 'ln -s /etc/rc.d/*.sh
/usr/local/etc/rc.d' because then base services would be started
twice.

A final thought --- taking the BSDish philosophy that symlinks and
execute bits are poor for communicating system configuration, local
services could be listed in rc.conf rather than having /etc/rc
execute
all scripts in /usr/local/etc/rc.d which have the execute bit and the
sh suffix.  If I don't want apache running, I would take it out of
rc.conf rather than set apache.sh's execute bit off (or remove it
from
rc.d, or rename it, or whatever).  This seems more the better way;
the
more BSD way :) The downside is it wouldn't be backward-compatible
(but trivially so).

Not much work would be needed to implement such a scheme.  What do
you
think?

Of course I could customize my own rc scripts, effectively having my
own FreeBSD "distribution" --- but I don't want to maintain such a
thing across several machines or across cvsups.

--Matt





__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

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




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