xref: /openbsd-src/share/man/man8/rc.8 (revision 3a3fbb3f2e2521ab7c4a56b7ff7462ebd9095ec5)
1.\"	$OpenBSD: rc.8,v 1.18 2001/12/28 16:21:04 millert Exp $
2.\"
3.\" Copyright (c) 1980, 1991, 1993
4.\"	The Regents of the University of California.  All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. All advertising materials mentioning features or use of this software
15.\"    must display the following acknowledgement:
16.\"	This product includes software developed by the University of
17.\"	California, Berkeley and its contributors.
18.\" 4. Neither the name of the University nor the names of its contributors
19.\"    may be used to endorse or promote products derived from this software
20.\"    without specific prior written permission.
21.\"
22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32.\" SUCH DAMAGE.
33.\"
34.\"     @(#)rc.8	8.2 (Berkeley) 12/11/93
35.\"
36.Dd December 11, 1993
37.Dt RC 8
38.Os
39.Sh NAME
40.Nm rc
41.Nd command scripts for system startup
42.Sh SYNOPSIS
43.Nm /etc/rc
44.Nm /etc/rc.conf
45.Nm /etc/rc.local
46.Nm /etc/rc.securelevel
47.Nm /etc/netstart
48.Nm /etc/rc.shutdown
49.Sh DESCRIPTION
50.Nm rc
51is the command script that is invoked by
52.Xr init 8
53during an automatic reboot and after single user mode is exited;
54it performs system housekeeping chores and starts up system daemons.
55As well,
56.Nm rc
57is intricately tied to the
58.Nm netstart
59script, which runs commands and daemons pertaining to the network.
60The
61.Nm rc.securelevel
62and
63.Nm rc.local
64scripts hold commands which are pertinent only to a specific site.
65.Pp
66All four of these startup scripts are (or can be) controlled to some
67extent by variables defined in
68.Nm rc.conf ,
69which specifies which daemons and services are to be run.
70.Pp
71When an automatic reboot is in progress,
72.Nm rc
73is invoked with the argument
74.Em autoboot .
75The first portion of
76.Nm rc
77runs an
78.Xr fsck 8
79with option
80.Fl p
81to
82.Dq preen
83all disks of minor inconsistencies resulting
84from the last system shutdown and to check for serious inconsistencies
85caused by hardware or software failure.
86If this auto-check and repair succeeds, then the second part of
87.Nm rc
88is run.
89.Pp
90However, if the file
91.Pa /fastboot
92exists,
93.Xr fsck 8
94will not be invoked during this boot.
95This file is then removed so that it will be run on subsequent boots.
96.Pp
97The second part of
98.Nm rc ,
99which is run after an auto-reboot succeeds and also if
100.Nm rc
101is invoked when a single user shell terminates (see
102.Xr init 8 ) ,
103then asks
104.Nm rc.conf
105for configuration variables,
106mounts filesystems, starts system daemons,
107preserves editor files,
108clears the scratch directory
109.Pa /tmp ,
110and saves any possible core image that might have been
111generated as a result of a system crash, with
112.Xr savecore 8 .
113.Pp
114Before
115.Nm rc
116starts most system daemons,
117.Nm netstart
118is executed.
119.Nm netstart
120defines the machine's name, configures various  network interfaces
121and system features, initializes the routing table, and numerous
122other tasks.
123.Pp
124.Nm rc.securelevel
125is executed by
126.Nm rc
127to start daemons that must run before the security level changes.
128Following this,
129.Nm rc
130then sets the security level to the value specified in the
131.Va securelevel
132variable in that file.
133.Pp
134.Nm rc.local
135is executed towards the end of
136.Nm rc
137(it is not the very last as there are a few services that must be
138the started at the very end).
139Normally,
140.Nm rc.local
141contains commands and daemons that are not part of the
142stock installation.
143.Sh CONFIGURATION EXAMPLES
144The
145.Nm rc.conf
146file contains a series of Bourne-shell syntax assignments that
147are used to configure kernel configurations, network configuration,
148and various other system daemons.
149As described above, this file is sourced (using
150.Xr sh 1
151of course) by
152.Pa /etc/rc .
153Various comments in
154.Nm rc.conf
155make it clear what each variable does.
156Refer to the specific man pages for each daemon to determine what that
157subsystem does.
158.Pp
159For example, the
160.Xr lpd 8
161daemon is controlled by the line
162.Bd -literal
163    lpd_flags=NO        # for normal use: "" (or "-l" for debugging)
164.Ed
165.Pp
166This does not start
167.Xr lpd 8
168at system startup.
169To start
170.Xr lpd 8 ,
171the following entry can be used.
172.Bd -literal
173    lpd_flags=""        # for normal use: "" (or "-l" for debugging)
174.Ed
175Alternately,
176.Xr lpd 8
177can be started with the
178.Fl l
179flag (to log remote connections).
180.Bd -literal
181    lpd_flags="-l"      # for normal use: "" (or "-l" for debugging)
182.Ed
183.Sh EXTERNAL INFLUENCES
184Before
185.Xr init 8
186starts
187.Nm rc ,
188it sets the process priority, umask, and resource limits according to the
189.Dq daemon
190login class as described in
191.Pa /etc/login.conf .
192.Sh SEE ALSO
193.Xr login.conf 5 ,
194.Xr sysctl.conf 5 ,
195.Xr init 8 ,
196.Xr rc.conf 8 ,
197.Xr rc.shutdown 8 ,
198.Xr reboot 8 ,
199.Xr savecore 8
200.Sh HISTORY
201The
202.Nm
203command appeared in
204.Bx 4.0 .
205