1.\" $OpenBSD: rc.8,v 1.16 2001/08/03 15:21:17 mpech 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. Refer to the specific man pages 156for each daemon to determine what that subsystem does. 157.Pp 158For example, the 159.Xr sendmail 8 160daemon is controlled by the line 161.Bd -literal 162 sendmail_flags=NO # for normal use: sendmail_flags="-bd -q30m" 163.Ed 164.Pp 165This does not start 166.Xr sendmail 8 167at system startup. But 168.Xr sendmail 8 169is started with the specified flags if the specification is modified to be 170.Bd -literal 171 sendmail_flags="-bd -q30m" # for 'normal' use: sendmail_flags="-bd -q30m" 172.Ed 173.Sh EXTERNAL INFLUENCES 174Before 175.Xr init 8 176starts 177.Nm rc , 178it sets the process priority, umask, and resource limits according to the 179.Dq daemon 180login class as described in 181.Pa /etc/login.conf . 182.Sh SEE ALSO 183.Xr login.conf 5 , 184.Xr sysctl.conf 5 , 185.Xr init 8 , 186.Xr rc.conf 8 , 187.Xr rc.shutdown 8 , 188.Xr reboot 8 , 189.Xr savecore 8 190.Sh HISTORY 191The 192.Nm 193command appeared in 194.Bx 4.0 . 195