RC(8) OpenBSD System Manager's Manual RC(8)NAME
rc - command scripts for system startup
SYNOPSIS
/etc/rc
/etc/rc.firsttime
/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, rc.firsttime, and
rc.local scripts hold commands which are pertinent only to a specific
site.
All 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.
If rc.firsttime exists, it is executed once and then deleted. Any output
is mailed to root. Do not install rc.firsttime from siteXX.tgz during a
system install since the installer may write to it too. Rather, install
an install.site script and let that script append the required commands
to rc.firsttime.
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). rc.local
is also used to execute rc.d(8) scripts defined in the rc_scripts
variable in rc.conf(8) in the specified order. Normally, rc.local also
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)
To start the a and b rc.d(8) scripts in a reserved order, one could
specify rc_scripts in the the following way:
rc_scripts="b a"
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.d Directory to hold rc.d(8) scripts.
/etc/rc.d/rc.subr File that contains functions used by the rc.d(8)
scripts.
/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.firsttime Commands run on the first boot after creation.
/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 not to run fsck(8) during the next boot.
SEE ALSOlogin.conf(5), sysctl.conf(5), securelevel(7), init(8), netstart(8),
rc.conf(8), rc.d(8), rc.shutdown(8), reboot(8), savecore(8)HISTORY
The rc command appeared in 4.0BSD.
OpenBSD 4.9 January 16, 2011 OpenBSD 4.9