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 $
34 .\" $DragonFly: src/share/man/man8/rc.8,v 1.2 2003/06/17 04:37:01 dillon Exp $
41 .Nd command scripts for auto\-reboot and daemon startup
58 is the command script which controls the automatic reboot
59 (calling the other scripts) and
61 is the script holding commands which are pertinent only
62 to a specific site. Typically, the /usr/local/etc/rc.d
63 mechanism is used instead of rc.local these days but if
64 you do want to use rc.local, /etc/rc still supports it.
65 In this case, rc.local should source /etc/rc.conf and
66 contain additional custom startup code for your system.
68 contains the global system configuration information referenced
69 by the rc files, while
71 contains the local system configuration.
77 directories contain scripts which will be automatically
78 executed at boot time and shutdown time.
80 the specified directories are processed immediately after
83 (See below for details on how to specify directories to check.)
85 the directories are processed by
87 The following key points apply to the scripts within each directory:
91 Scripts are only executed if their
93 matches the shell globbing pattern
95 and they are executable.
96 Any other files or directories present within the directory are silently
99 When a script is executed at boot time, it is passed the string
101 as its first and only argument.
102 At shutdown time, it is passed the string
104 as its first and only argument.
107 scripts are expected to handle these arguments appropriately.
108 If no action needs to be taken at a given time
109 (either boot time or shutdown time)
110 the script should exit successfully and without producing an error message.
112 The scripts within each directory are executed in lexicographical order.
113 If a specific order is required,
114 numbers may be used as a prefix to the existing filenames,
117 would be executed before
119 without the numeric prefixes the opposite would be true.
122 The output from each script is traditionally a space character,
123 followed by the name of the software package being started or shut down,
125 a trailing newline character (see the
129 The system initialization scripts can execute scripts from multiple
132 The default locations are
133 .Pa /usr/local/etc/rc.d
135 .Pa /usr/X11R6/etc/rc.d ,
136 but these may be overridden with the
142 is the command script which contains any necessary commands
143 to be executed as the system is shut down.
145 When an automatic reboot is in progress,
147 is invoked with the argument
155 to ``preen'' all the disks of minor inconsistencies resulting
156 from the last system shutdown and to check for serious inconsistencies
157 caused by hardware or software failure.
158 If this auto-check and repair succeeds, then the second part of
164 which is run after an auto-reboot succeeds and also if
166 is invoked when a single user shell terminates (see
168 starts all the daemons on the system, preserves editor files
169 and clears the scratch directory
173 is run very early in the startup process, immediately before the
177 is used to set any special configurations for serial devices.
180 is used to enable PC-cards.
183 is used to start the network.
184 The network is started in three passes.
185 The first pass sets the hostname and domainname, configures the network
186 interfaces, turns on any IP firewall rules, and starts routing.
187 The second pass starts most of the network related daemons.
188 The third pass starts NFS, amd, rwhod, Kerberos and
189 the multicast routing daemon.
192 is used to configure rules for the kernel based firewall
194 It has several possible options:
196 .Bl -tag -width "fBfilename" -compact -offset indent
198 will allow anyone in.
200 will try to protect just this machine.
202 will try to protect a whole network.
204 totally disables IP services except via lo0 interface.
206 disables the loading of firewall rules.
208 will load the rules in the given filename (full path required).
212 is used to configure ATM network interfaces.
213 The interfaces are configured in three passes.
214 The first pass performs the initial interface configuration.
215 The second pass completes the interface configuration and defines PVCs and
216 permanent ATMARP entries.
217 The third pass starts any ATM daemons.
220 runs architecture specific programs.
223 is executed after the scripts above, but before the rest of the
226 In a default installation
228 does not exist, but its contents will be executed if the file is created
229 by the administrator.
231 Following tradition, the startup files reside in
234 The following is a simple, hypothetical example of an
237 which would start a daemon at boot time,
238 and kill it at shutdown time.
239 .Bd -literal -offset indent
242 # initialization/shutdown script for foobar package
246 /usr/local/sbin/foo -d && echo -n ' foo'
249 kill `cat /var/run/foo.pid` && echo -n ' foo'
252 echo "unknown option: $1 - should be 'start' or 'stop'" >&2
257 As all processes are killed by
259 at shutdown, the explicit
261 is unnecessary, but is often included.