1 .\" Copyright (c) 1980, 1991, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\" must display the following acknowledgement:
14 .\" This product includes software developed by the University of
15 .\" California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" @(#)rc.8 8.2 (Berkeley) 12/11/93
33 .\" $FreeBSD: src/share/man/man8/rc.8,v 1.9.2.7 2002/08/23 16:57:42 schweikh Exp $
40 .Nd command scripts for auto\-reboot and daemon startup
57 is the command script which controls the automatic reboot
58 (calling the other scripts) and
60 is the script holding commands which are pertinent only
61 to a specific site. Typically, the /usr/local/etc/rc.d
62 mechanism is used instead of rc.local these days but if
63 you do want to use rc.local, /etc/rc still supports it.
64 In this case, rc.local should source /etc/rc.conf and
65 contain additional custom startup code for your system.
67 contains the global system configuration information referenced
68 by the rc files, while
70 contains the local system configuration.
76 directories contain scripts which will be automatically
77 executed at boot time and shutdown time.
79 the specified directories are processed immediately after
82 (See below for details on how to specify directories to check.)
84 the directories are processed by
86 The following key points apply to the scripts within each directory:
90 Scripts are only executed if their
92 matches the shell globbing pattern
94 and they are executable.
95 Any other files or directories present within the directory are silently
98 When a script is executed at boot time, it is passed the string
100 as its first and only argument.
101 At shutdown time, it is passed the string
103 as its first and only argument.
106 scripts are expected to handle these arguments appropriately.
107 If no action needs to be taken at a given time
108 (either boot time or shutdown time)
109 the script should exit successfully and without producing an error message.
111 The scripts within each directory are executed in lexicographical order.
112 If a specific order is required,
113 numbers may be used as a prefix to the existing filenames,
116 would be executed before
118 without the numeric prefixes the opposite would be true.
121 The output from each script is traditionally a space character,
122 followed by the name of the software package being started or shut down,
124 a trailing newline character (see the
128 The system initialization scripts can execute scripts from multiple
131 The default locations are
132 .Pa /usr/local/etc/rc.d
134 .Pa /usr/X11R6/etc/rc.d ,
135 but these may be overridden with the
141 is the command script which contains any necessary commands
142 to be executed as the system is shut down.
144 When an automatic reboot is in progress,
146 is invoked with the argument
154 to ``preen'' all the disks of minor inconsistencies resulting
155 from the last system shutdown and to check for serious inconsistencies
156 caused by hardware or software failure.
157 If this auto-check and repair succeeds, then the second part of
163 which is run after an auto-reboot succeeds and also if
165 is invoked when a single user shell terminates (see
167 starts all the daemons on the system, preserves editor files
168 and clears the scratch directory
172 is run very early in the startup process, immediately before the
176 is used to set any special configurations for serial devices.
179 is used to enable PC-cards.
182 is used to start the network.
183 The network is started in three passes.
184 The first pass sets the hostname and domainname, configures the network
185 interfaces, turns on any IP firewall rules, and starts routing.
186 The second pass starts most of the network related daemons.
187 The third pass starts NFS, amd, rwhod, Kerberos and
188 the multicast routing daemon.
191 is used to configure rules for the kernel based firewall
193 It has several possible options:
195 .Bl -tag -width "fBfilename" -compact -offset indent
197 will allow anyone in.
199 will try to protect just this machine.
201 will try to protect a whole network.
203 totally disables IP services except via lo0 interface.
205 disables the loading of firewall rules.
207 will load the rules in the given filename (full path required).
211 is used to configure ATM network interfaces.
212 The interfaces are configured in three passes.
213 The first pass performs the initial interface configuration.
214 The second pass completes the interface configuration and defines PVCs and
215 permanent ATMARP entries.
216 The third pass starts any ATM daemons.
219 runs architecture specific programs.
222 is executed after the scripts above, but before the rest of the
225 In a default installation
227 does not exist, but its contents will be executed if the file is created
228 by the administrator.
230 Following tradition, the startup files reside in
233 The following is a simple, hypothetical example of an
236 which would start a daemon at boot time,
237 and kill it at shutdown time.
238 .Bd -literal -offset indent
241 # initialization/shutdown script for foobar package
245 /usr/local/sbin/foo -d && echo -n ' foo'
248 kill `cat /var/run/foo.pid` && echo -n ' foo'
251 echo "unknown option: $1 - should be 'start' or 'stop'" >&2
256 As all processes are killed by
258 at shutdown, the explicit
260 is unnecessary, but is often included.