System initialization

Brett Glass brett at lariat.net
Wed Apr 18 23:37:00 UTC 2012


Everyone:

I have several nearly identical servers in my network, and would 
like to control their configurations entirely from one file (such 
as /etc/rc.conf). Unfortunately, while some flavors of embedded 
Linux have systems to do this, FreeBSD doesn't make it easy. A lot 
of files (/etc/resolv.conf, /etc/hosts, /etc/ttys, /etc/crontab, 
etc.) have to be set up independently of rc.conf, and since rc.conf 
can be run many times at boot and thereafter (for example, 
/etc/rc.firewall uses it to suck in environment variables), one 
doesn't want to generate configuration files directly from within 
it, but rather should edit the configuration file for each daemon 
-- using environment variables in rc.conf -- just each is started. 
Also, it may be impossible to generate configurations for some 
daemons or system components before they start, so it might be 
necessary to start with some default file, edit it, and then send a 
signal to force a reconfiguration. Most of the default rc scripts, 
in /etc/rc and in ports, don't always provide well for generation 
of configuration files and/or command line options and arguments 
prior to starting daemons.

And then, there's the question of how to restart daemons (but not 
the whole system!) when configurations are changed... when this is possible.

Has anyone out there worked on the problem of generating 
configuration files for important daemons (e.g. mpd, dnscache from 
the djbdns suite, ntpd, etc.) at boot time based on rc.conf -- and 
as many as possible early enough so that the daemons whose 
configurations are being generated won't already have been started? 
And has anyone attacked the problem of dynamic reconfiguration? I'm 
sure I could work out my own scheme for this, but don't want to 
reinvent the wheel if someone's already come up with a clever 
system to do it on FreeBSD.

--Brett Glass



More information about the freebsd-questions mailing list