|
rc.conf
There are many features that FreeBSD includes that are enabled simply by adding a line to one file.
The /etc/defaults/rc.conf file contains a list of variables and their values. Some of these variables include:
- hostname - To set your hostname.
- natd_enable - To enable natd.
- ifconfig_interface - To set your TCP/IP settings on your network interface
- named_enable - To enable DNS
- sshd_enable - To enable the ssh server
- static_routes - To enter static routes
- ppp_enable - To enable PPP
- local_startup - To define startup script directory (see above)
- See the file and "man rc.conf" for many more options
If you want to over-ride any of the values in this file, you need to create a file called /etc/rc.conf with your desired values. This file is *usually* created during FreeBSD's install and contain the ifconfig and hostname settings that you specify initially. Any additions you make to your over-ride file will take affect on the next reboot.
It is actually the /etc/rc file that does all of the work. In the case of /usr/local/etc/rc.d it looks for the "local_startup" directory in rc.conf and runs any .sh files in that directory. For all of the above variables (and a lot more), rc searches the rc.conf files for the approriate values and acts upon them. It calls rc.network, rc.firewall, rc.i386 and a couple others to accomplish this. Here's an example with named (DNS) server. In your rc.conf file, you set the following values:
named_enable="YES" # Run named, the DNS server (or NO). named_program="named"
# path to named, if you want a different one. named_flags="-q" # Flags for named
On boot-up, the /etc/rc file calls /etc/rc.network, which runs the following:
case ${named_enable} in [Yy][Ee][Ss]) echo -n ' named'; ${named_program:-named}
${named_flags} ;; esac
As you can see, the rc.network script deterimines if you want to run named (if named_enable="YES"). It then executes whatever is in named_program (named by default) with named_flags as its flags (options). So, using our variables above, it would execute:
named -q
Seems a little cumbersome just to execute a simple command, huh? Well if you think about how scalable and structured this feature is, you'll realize how simple it
makes things. The rc files take care of the details for you.
More information on these files can be found in the appropriate man pages.
roddie
- roddie@krweb.net - v4.29.00
|