Confused about connection between an option in rc.conf and the
associated action?
Giorgos Keramidas
keramida at ceid.upatras.gr
Sat Mar 12 18:13:39 PST 2005
# Redirected from freebsd-newbies to freebsd-questions.
# Please do not post technical questions to freebsd-newbies.
# This is what freebsd-questions is for. Followups set.
On 2005-03-13 02:49, Ola Theander <ola.theander at otsystem.com> wrote:
> Dear subscribers
>
> I'm slightly confused about enabling an option in rc.conf and the associated
> action? E.g. say that I enable gateway_enable="YES" or maybe
> dhcpd_enable="YES", how does FreeBSD associate this simple line to the
> associated action? I've had a theory that adding e.g. test_enable="YES" to
> rc.conf would trigger the execution of the file /etc/rc.d/test.sh at boot
> time but it seems like this isn't how it's done.
The /etc/rc script is the first "rc script" that runs. This is the one
that takes care of running all the rest of the rc stuff.
In pre-5.X versions of FreeBSD, the /etc/rc script called a predefined
set of /etc/rc.* scripts at specific points during the startup process,
delegating pieces of the work to them.
In 5.3-RELEASE and later versions of FreeBSD, there is a collection of
small /etc/rc.d/* scripts, that are called by /etc/rc instead of the
older /etc/rc.* stuff. The specific order these scripts will have is
determined at boot time, by the /sbin/rcorder utility.
Each script, either one of the older /etc/rc.* stuff or the newer
/etc/rc.d/* scripts, slurps in /etc/rc.conf and then checks what parts
of the script are enabled to run. It is the responsibility of the
specific script to check the proper rc.conf variables and act
accordingly.
A small example of an rc script that checks a variable and modifies its
own behavior is /etc/rc.d/tmp, which contains (among other stuff):
load_rc_config $name
# If we do not have a writable /tmp, create a memory
# filesystem for /tmp. If /tmp is a symlink (e.g. to /var/tmp,
# then it should already be writable).
#
case "${tmpmfs}" in
[Yy][Ee][Ss])
...
Thus, it's not /etc/rc that checks the "tmpfs" variable from rc.conf,
but the specific script that is interested in its value.
Regards,
Giorgos
More information about the freebsd-questions
mailing list