RC(8) AerieBSD 1.0 Refernce Manual RC(8)

NAME

rc — command scripts for system startup

SYNOPSIS

/etc/rc /etc/rc.local /etc/rc.securelevel

DESCRIPTION

rc is the command script that is invoked by init(8) during an automatic reboot and after single user mode is exited; it performs system housekeeping chores and starts up system daemons. Additionally, rc is intricately tied to the netstart(8) script, which runs commands and daemons pertaining to the network. The rc.securelevel and rc.local scripts hold commands which are pertinent only to a specific site.

All four of these startup scripts are (or can be) controlled to some extent by variables defined in rc.conf(8) and rc.conf.local(8), which specify which daemons and services to run.

When an automatic reboot is in progress, rc is invoked with the argument autoboot. The first portion of rc runs an fsck(8) with option -p to “preen” all disks of minor inconsistencies resulting from the last system shutdown and to check for serious inconsistencies caused by hardware or software failure. If this auto-check and repair succeeds, then the second part of rc is run.

However, if the file /fastboot exists, fsck(8) will not be invoked during this boot. This file is then removed so that fsck will be run on subsequent boots.

The second part of rc, which is run after an auto-reboot succeeds and also if rc is invoked when a single user shell terminates (see init(8/)), then asks rc.conf(8) for configuration variables, mounts filesystems, starts system daemons, preserves editor files, clears the scratch directory /tmp, and saves any possible core image that might have been generated as a result of a system crash, with savecore(8).

Before rc starts most system daemons, netstart(8) is executed.

rc.securelevel is executed by rc to start daemons that must be run before the security level changes. Following this, rc then sets the security level to the value specified in the securelevel variable in that file. See securelevel(7) for the effects of setting the security level.

rc.local is executed towards the end of rc (it is not the very last as there are a few services that must be started at the very end). Normally, rc.local contains commands and daemons that are not part of the stock installation.

CONFIGURATION EXAMPLES

The rc.conf(8) file contains a series of Bourne-shell syntax assignments that are used to configure kernel configurations, network configuration, and various other system daemons. As described above, this file is sourced (using sh(1) of course) by /etc/rc. Various comments in rc.conf(8) make it clear what each variable does. Refer to the specific man pages for each daemon to determine what that subsystem does.

For example, the lpd(8) daemon is controlled by the following line:

lpd_flags=NO        # for normal use: "" (or "-l" for debugging)

This does not start lpd(8) at system startup. To start lpd(8), the following entry can be used:

lpd_flags=""        # for normal use: "" (or "-l" for debugging)

Alternately, lpd(8) can be started with the -l flag (to log remote connections):

lpd_flags="-l"      # for normal use: "" (or "-l" for debugging)

EXTERNAL INFLUENCES

Before init(8) starts rc, it sets the process priority, umask, and resource limits according to the “daemon” login class as described in login.conf(5).

FILES

/etc/rc
Command scripts for system startup.
/etc/rc.local
Site specific command scripts for system startup.
/etc/rc.conf
System daemon configuration database.
/etc/rc.conf.local
Site specific daemon configuration database.
/etc/rc.securelevel
Commands run before the security level changes.
/etc/rc.shutdown
Commands run at system shutdown.
/etc/login.conf
Login class capability database.
/etc/netstart
Command script for network startup.
/fastboot
Tells rc(8) not to run fsck(8) during the next boot.

SEE ALSO

login.conf(5), sysctl.conf(5), securelevel(7), init(8), netstart(8), rc.conf(8), rc.shutdown(8), reboot(8), savecore(8)

HISTORY

The rc command appeared in 4.0BSD.


AerieBSD 1.0 Reference Manual August 26 2008 RC(8)