all in rc.conf or /etc files?

Hi,
just a curiosity: what is the rationale behind the choice of FreeBSD to have all services, interfaces, and stuff configured via /etc/rc.conf while other BSDs, such as OpenBSD, choose to have a file for interface (as in other commercial Unixes like Solaris too)?
 
I prefer the FreeBSD way were everything is in one file, instead of several.
 
There's one reasonable way to split the rc.conf(5) settings to multiple files and that is to use /etc/rc.conf for base system settings and /etc/rc.conf.local for settings that apply to ports/packages only.
 
kpa said:
There's one reasonable way to split the rc.conf(5) settings to multiple files and that is to use /etc/rc.conf for base system settings and /etc/rc.conf.local for settings that apply to ports/packages only.

/usr/local/etc/rc.conf would probably be a better place ;)
 
Yes, that would be even better place. However, the rc_conf_files variable is set like this in /etc/defaults/rc.conf:

Code:
rc_conf_files="/etc/rc.conf /etc/rc.conf.local"

If you want utitilies like service(8) to be aware of any additional rc.conf(5) files you'll have to modify that.
 
True. Wouldn't adding this to /etc/rc.conf work too?

Somewhere at the end:
Code:
. /usr/local/etc/rc.conf
 
That works. Allthough you want to test if the file is readable first.

Code:
[ -r /usr/local/etc/rc.conf ] && . /usr/local/etc/rc.conf

Edit: Does not work actually, the code does not get evaluated at boot up.
 
fluca1978 said:
Hi,
just a curiosity: what is the rationale behind the choice of FreeBSD to have all services, interfaces, and stuff configured via /etc/rc.conf .... ?

rc.conf(5)

# mkdir /etc/rc.conf.d

Place then service's configuration to a separate file(s) in the directory /etc/rc.conf.d to a file with name equal to the service's name.

So, for Apache it would be /etc/rc.conf.d/apache22
for MySQL it would be /etc/rc.conf.d/mysql-server and so on...

No mess, all configuration that related to particular service stay in separate configuration file.

By the way, if you create /etc/rc.conf.d/jail you can keep there separate configuration for jail(s) too.
 
I personally love my system configuration in rc.conf. On Gentoo I needed to edit a lot of files in /etc/conf.d/*. almost of these files only have two or less variables.
 
@kpa has the answer in his first post. The scientists who created Unix did it that way and FreeBSD is a direct descendant of Unix. Now, why they did that, iirc, might have had something to do with the limited size of disks back then. Having everything in one location makes it easier to find things, too, rather than having them scattered all about as Linux does (from what I hear).
 
The rational is that rc.conf does not force you to use a single file. Although it is primarily used for variables it is actually a script in and of itself invoked from /etc/rc or scripts in /etc/rc.d/. So your free to separate files as you see fit in rc.conf.

It follows the core of the Unix principle of keeping it simple. It is up to a system administrator to create more complicated systems if they so wish.

Case in point I sometimes separate files on desktop system but in jails since they only run a couple daemons their rc.conf is so short I don't bother. Only consequence is ordering the files and not using the same setting in more than one file which on a couple occasions which wasted a tiny bit of time tracking down. But then again you can the exact same problem with very large files.

Freebsd gives you the choice, it's up to you.
 
kpa said:
There's one reasonable way to split the rc.conf(5) settings to multiple files and that is to use /etc/rc.conf for base system settings and /etc/rc.conf.local for settings that apply to ports/packages only.

If you have multiple systems that are virtually identical (for example, firewalls), then it's better to use /etc/rc.conf for settings that are common across them all, and /etc/rc.conf.local for settings that are specific to that one system (like hostname, ifconfig, etc).
 
Back
Top