1994-05-30 19:09:18 +00:00
|
|
|
.\" Copyright (c) 1980, 1991, 1993
|
|
|
|
.\" The Regents of the University of California. All rights reserved.
|
|
|
|
.\"
|
2002-11-21 20:12:05 +00:00
|
|
|
.\" Portions of this manual page are Copyrighted by
|
|
|
|
.\" The NetBSD Foundation.
|
|
|
|
.\"
|
1994-05-30 19:09:18 +00:00
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\" 3. All advertising materials mentioning features or use of this software
|
|
|
|
.\" must display the following acknowledgement:
|
|
|
|
.\" This product includes software developed by the University of
|
|
|
|
.\" California, Berkeley and its contributors.
|
|
|
|
.\" 4. Neither the name of the University nor the names of its contributors
|
|
|
|
.\" may be used to endorse or promote products derived from this software
|
|
|
|
.\" without specific prior written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
|
|
|
.\" @(#)rc.8 8.2 (Berkeley) 12/11/93
|
1999-08-28 00:22:10 +00:00
|
|
|
.\" $FreeBSD$
|
1994-05-30 19:09:18 +00:00
|
|
|
.\"
|
2005-12-19 08:48:57 +00:00
|
|
|
.Dd December 19, 2005
|
1994-05-30 19:09:18 +00:00
|
|
|
.Dt RC 8
|
2001-07-10 15:31:11 +00:00
|
|
|
.Os
|
1994-05-30 19:09:18 +00:00
|
|
|
.Sh NAME
|
|
|
|
.Nm rc
|
2002-11-29 11:39:20 +00:00
|
|
|
.Nd command scripts for auto-reboot and daemon startup
|
1994-05-30 19:09:18 +00:00
|
|
|
.Sh SYNOPSIS
|
2000-11-20 18:41:33 +00:00
|
|
|
.Nm
|
1998-02-26 02:44:17 +00:00
|
|
|
.Nm rc.conf
|
|
|
|
.Nm rc.conf.local
|
2002-11-29 11:39:20 +00:00
|
|
|
.Nm rc.d/
|
1998-02-26 02:44:17 +00:00
|
|
|
.Nm rc.firewall
|
1994-05-30 19:09:18 +00:00
|
|
|
.Nm rc.local
|
1998-02-26 02:44:17 +00:00
|
|
|
.Nm rc.shutdown
|
2002-11-21 20:12:05 +00:00
|
|
|
.Nm rc.subr
|
1994-05-30 19:09:18 +00:00
|
|
|
.Sh DESCRIPTION
|
2002-07-14 14:58:11 +00:00
|
|
|
The
|
|
|
|
.Nm
|
2002-11-21 20:12:05 +00:00
|
|
|
utility is the command script which controls the automatic boot process
|
|
|
|
after being called by
|
|
|
|
.Xr init 8 .
|
|
|
|
The
|
1994-05-30 19:09:18 +00:00
|
|
|
.Nm rc.local
|
2002-11-21 20:12:05 +00:00
|
|
|
script contains commands which are pertinent only
|
2002-11-29 11:39:20 +00:00
|
|
|
to a specific site.
|
|
|
|
Typically, the
|
|
|
|
.Pa /usr/local/etc/rc.d/
|
2002-11-21 20:12:05 +00:00
|
|
|
mechanism is used instead of
|
|
|
|
.Nm rc.local
|
|
|
|
these days but if
|
|
|
|
you want to use
|
2002-11-29 11:39:20 +00:00
|
|
|
.Nm rc.local ,
|
|
|
|
it is still supported.
|
|
|
|
In this case, it should source
|
|
|
|
.Pa /etc/rc.conf
|
2002-11-21 20:12:05 +00:00
|
|
|
and contain additional custom startup code for your system.
|
|
|
|
The best way to handle
|
2002-11-29 11:39:20 +00:00
|
|
|
.Nm rc.local ,
|
2002-11-21 20:12:05 +00:00
|
|
|
however, is to separate it out into
|
2002-11-29 11:39:20 +00:00
|
|
|
.Nm rc.d/
|
|
|
|
style scripts and place them under
|
|
|
|
.Pa /usr/local/etc/rc.d/ .
|
2002-07-14 14:58:11 +00:00
|
|
|
The
|
|
|
|
.Nm rc.conf
|
|
|
|
file contains the global system configuration information referenced
|
2002-11-21 20:12:05 +00:00
|
|
|
by the startup scripts, while
|
1998-02-26 02:44:17 +00:00
|
|
|
.Nm rc.conf.local
|
2001-08-08 11:48:28 +00:00
|
|
|
contains the local system configuration.
|
|
|
|
See
|
2002-11-21 20:12:05 +00:00
|
|
|
.Xr rc.conf 5
|
|
|
|
for more information.
|
1998-02-26 02:44:17 +00:00
|
|
|
.Pp
|
2000-07-19 19:08:08 +00:00
|
|
|
The
|
2002-11-29 11:39:20 +00:00
|
|
|
.Nm rc.d/
|
2000-07-19 19:08:08 +00:00
|
|
|
directories contain scripts which will be automatically
|
|
|
|
executed at boot time and shutdown time.
|
2002-11-29 11:39:20 +00:00
|
|
|
.Ss Operation of Nm
|
2002-11-21 20:12:05 +00:00
|
|
|
.Bl -enum
|
|
|
|
.It
|
|
|
|
If autobooting, set
|
2002-11-29 11:39:20 +00:00
|
|
|
.Va autoboot Ns = Ns Li yes
|
2002-11-21 20:12:05 +00:00
|
|
|
and enable a flag
|
2002-11-29 11:39:20 +00:00
|
|
|
.Pq Va rc_fast Ns = Ns Li yes ,
|
2002-11-21 20:12:05 +00:00
|
|
|
which prevents the
|
2002-11-29 11:39:20 +00:00
|
|
|
.Nm rc.d/
|
2002-11-21 20:12:05 +00:00
|
|
|
scripts from performing the check for already running processes
|
|
|
|
(thus speeding up the boot process).
|
|
|
|
This
|
2002-11-29 11:39:20 +00:00
|
|
|
.Va rc_fast Ns = Ns Li yes
|
|
|
|
speedup will not occur when
|
2002-11-21 20:12:05 +00:00
|
|
|
.Nm
|
|
|
|
is started up after exiting the single-user shell.
|
|
|
|
.It
|
2005-12-19 08:48:57 +00:00
|
|
|
Determine whether the system is booting diskless,
|
|
|
|
and if so run the
|
|
|
|
.Pa /etc/rc.initdiskless
|
|
|
|
script.
|
|
|
|
.It
|
|
|
|
Source
|
|
|
|
.Pa /etc/rc.subr
|
|
|
|
to load various
|
|
|
|
.Xr rc.subr 8
|
|
|
|
shell functions to use.
|
|
|
|
.It
|
|
|
|
Load the configuration files.
|
|
|
|
.It
|
|
|
|
Determine if booting in a jail,
|
|
|
|
and add
|
|
|
|
.Dq nojail
|
|
|
|
to the list of KEYWORDS to skip in
|
|
|
|
.Xr rcorder 8 .
|
|
|
|
.It
|
2002-11-21 20:12:05 +00:00
|
|
|
Invoke
|
|
|
|
.Xr rcorder 8
|
|
|
|
to order the files in
|
|
|
|
.Pa /etc/rc.d/
|
|
|
|
that do not have a
|
2002-11-29 11:39:20 +00:00
|
|
|
.Dq Li nostart
|
2005-12-19 08:48:57 +00:00
|
|
|
KEYWORD (refer to
|
2002-11-29 11:39:20 +00:00
|
|
|
.Xr rcorder 8 Ns 's
|
2002-11-21 20:12:05 +00:00
|
|
|
.Fl s
|
2005-12-19 08:48:57 +00:00
|
|
|
flag).
|
2002-11-21 20:12:05 +00:00
|
|
|
.It
|
2002-11-29 11:39:20 +00:00
|
|
|
Call each script in turn using
|
|
|
|
.Fn run_rc_script
|
|
|
|
(from
|
2002-11-21 20:12:05 +00:00
|
|
|
.Xr rc.subr 8 ) ,
|
|
|
|
which sets
|
2002-11-29 11:39:20 +00:00
|
|
|
.Va $1
|
2002-11-21 20:12:05 +00:00
|
|
|
to
|
2002-11-29 11:39:20 +00:00
|
|
|
.Dq Li start ,
|
2002-11-21 20:12:05 +00:00
|
|
|
and sources the script in a subshell.
|
|
|
|
If the script has a
|
2002-11-29 11:39:20 +00:00
|
|
|
.Pa .sh
|
2002-11-21 20:12:05 +00:00
|
|
|
suffix then it is sourced directly into the current shell.
|
2005-12-19 08:48:57 +00:00
|
|
|
Stop processing when the script that is the value of the
|
|
|
|
.Va $early_late_divider
|
|
|
|
has been run.
|
|
|
|
.It
|
|
|
|
Re-run
|
|
|
|
.Xr rcorder 8 ,
|
|
|
|
this time including the scripts in the
|
|
|
|
.Va $local_startup
|
|
|
|
directories.
|
|
|
|
Ignore everything up to the
|
|
|
|
.Va $early_late_divider ,
|
|
|
|
then start executing the scripts as described above.
|
2002-11-21 20:12:05 +00:00
|
|
|
.El
|
2002-11-29 11:39:20 +00:00
|
|
|
.Ss Operation of Nm rc.shutdown
|
2002-11-21 20:12:05 +00:00
|
|
|
.Bl -enum
|
|
|
|
.It
|
|
|
|
Source
|
|
|
|
.Pa /etc/rc.subr
|
|
|
|
to load various
|
|
|
|
.Xr rc.subr 8
|
|
|
|
shell functions to use.
|
|
|
|
.It
|
2005-12-19 08:48:57 +00:00
|
|
|
Load the configuration files.
|
|
|
|
.It
|
2002-11-21 20:12:05 +00:00
|
|
|
Invoke
|
|
|
|
.Xr rcorder 8
|
|
|
|
to order the files in
|
|
|
|
.Pa /etc/rc.d/
|
2005-12-19 08:48:57 +00:00
|
|
|
and the
|
|
|
|
.Va $local_startup
|
|
|
|
directories
|
2002-11-21 20:12:05 +00:00
|
|
|
that have a
|
2002-11-29 11:39:20 +00:00
|
|
|
.Dq Li shutdown
|
2005-12-19 08:48:57 +00:00
|
|
|
KEYWORD (refer to
|
2002-11-29 11:39:20 +00:00
|
|
|
.Xr rcorder 8 Ns 's
|
2002-11-21 20:12:05 +00:00
|
|
|
.Fl k
|
|
|
|
flag),
|
2002-11-29 11:39:20 +00:00
|
|
|
reverse that order, and assign the result to a variable.
|
2002-11-21 20:12:05 +00:00
|
|
|
.It
|
2002-11-29 11:39:20 +00:00
|
|
|
Call each script in turn using
|
|
|
|
.Fn run_rc_script
|
|
|
|
(from
|
2002-11-21 20:12:05 +00:00
|
|
|
.Xr rc.subr 8 ) ,
|
|
|
|
which sets
|
2002-11-29 11:39:20 +00:00
|
|
|
.Va $1
|
2002-11-21 20:12:05 +00:00
|
|
|
to
|
2002-11-29 11:39:20 +00:00
|
|
|
.Dq Li stop ,
|
2002-11-21 20:12:05 +00:00
|
|
|
and sources the script in a subshell.
|
|
|
|
If the script has a
|
2002-11-29 11:39:20 +00:00
|
|
|
.Pa .sh
|
2002-11-21 20:12:05 +00:00
|
|
|
suffix then it is sourced directly into the current shell.
|
|
|
|
.El
|
2002-11-29 11:39:20 +00:00
|
|
|
.Ss Contents of Nm rc.d/
|
2002-11-21 20:12:05 +00:00
|
|
|
.Nm rc.d/
|
|
|
|
is located in
|
2002-11-29 11:39:20 +00:00
|
|
|
.Pa /etc/rc.d/ .
|
2002-11-21 20:12:05 +00:00
|
|
|
The following file naming conventions are currently used in
|
|
|
|
.Nm rc.d/ :
|
2002-11-29 11:39:20 +00:00
|
|
|
.Bl -tag -width ".Pa ALLUPPERCASE" -offset indent
|
2002-11-21 20:12:05 +00:00
|
|
|
.It Pa ALLUPPERCASE
|
|
|
|
Scripts that are
|
2002-11-29 11:39:20 +00:00
|
|
|
.Dq placeholders
|
2002-11-21 20:12:05 +00:00
|
|
|
to ensure that certain operations are performed before others.
|
|
|
|
In order of startup, these are:
|
2002-11-29 11:39:20 +00:00
|
|
|
.Bl -tag -width ".Pa NETWORKING"
|
2002-11-21 20:12:05 +00:00
|
|
|
.It Pa NETWORKING
|
|
|
|
Ensure basic network services are running, including general
|
2005-12-19 08:48:57 +00:00
|
|
|
network configuration.
|
2002-11-21 20:12:05 +00:00
|
|
|
.It Pa SERVERS
|
2005-12-19 08:48:57 +00:00
|
|
|
Ensure basic services
|
2002-11-21 20:12:05 +00:00
|
|
|
exist for services that start early (such as
|
|
|
|
.Pa named ) ,
|
2002-11-29 11:39:20 +00:00
|
|
|
because they are required by
|
2002-11-21 20:12:05 +00:00
|
|
|
.Pa DAEMON
|
|
|
|
below.
|
|
|
|
.It Pa DAEMON
|
|
|
|
Check-point before all general purpose daemons such as
|
|
|
|
.Pa lpd
|
|
|
|
and
|
|
|
|
.Pa ntpd .
|
|
|
|
.It Pa LOGIN
|
|
|
|
Check-point before user login services
|
|
|
|
.Pa ( inetd
|
|
|
|
and
|
|
|
|
.Pa sshd ) ,
|
|
|
|
as well as services which might run commands as users
|
|
|
|
.Pa ( cron
|
|
|
|
and
|
|
|
|
.Pa sendmail ) .
|
|
|
|
.El
|
|
|
|
.It Pa foo.sh
|
|
|
|
Scripts that are to be sourced into the current shell rather than a subshell
|
|
|
|
have a
|
2002-11-29 11:39:20 +00:00
|
|
|
.Pa .sh
|
2002-11-21 20:12:05 +00:00
|
|
|
suffix.
|
|
|
|
Extreme care must be taken in using this, as the startup sequence will
|
|
|
|
terminate if the script does.
|
|
|
|
.It Pa bar
|
|
|
|
Scripts that are sourced in a subshell.
|
|
|
|
These can stop the boot if necessary with the following shell
|
|
|
|
commands:
|
2002-11-29 11:39:20 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
if [ "$autoboot" = yes ]; then
|
|
|
|
kill -TERM $$
|
|
|
|
fi
|
|
|
|
exit 1
|
2002-11-21 20:12:05 +00:00
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
Note that this should be used extremely sparingly!
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
Each script should contain
|
|
|
|
.Xr rcorder 8
|
|
|
|
keywords, especially an appropriate
|
2002-11-29 11:39:20 +00:00
|
|
|
.Dq Li PROVIDE
|
2002-11-21 20:12:05 +00:00
|
|
|
entry, and if necessary
|
2002-11-29 11:39:20 +00:00
|
|
|
.Dq Li REQUIRE
|
2002-11-21 20:12:05 +00:00
|
|
|
and
|
2002-11-29 11:39:20 +00:00
|
|
|
.Dq Li BEFORE
|
|
|
|
keywords.
|
2002-11-21 20:12:05 +00:00
|
|
|
.Pp
|
|
|
|
Each script is expected to support at least the following arguments, which
|
2002-11-29 11:39:20 +00:00
|
|
|
are automatically supported if it uses the
|
|
|
|
.Fn run_rc_command
|
|
|
|
function:
|
|
|
|
.Bl -tag -width ".Cm restart" -offset indent
|
|
|
|
.It Cm start
|
2002-11-21 20:12:05 +00:00
|
|
|
Start the service.
|
|
|
|
This should check that the service is to be started as specified by
|
|
|
|
.Xr rc.conf 5 .
|
|
|
|
Also checks if the service is already running and refuses to start if
|
|
|
|
it is.
|
|
|
|
This latter check is not performed by standard
|
|
|
|
.Fx
|
|
|
|
scripts if the system is starting directly to multi-user mode, to
|
|
|
|
speed up the boot process.
|
|
|
|
If
|
2002-11-29 11:39:20 +00:00
|
|
|
.Cm forcestart
|
2002-11-21 20:12:05 +00:00
|
|
|
is given, ignore the
|
|
|
|
.Xr rc.conf 5
|
|
|
|
check and start anyway.
|
2002-11-29 11:39:20 +00:00
|
|
|
.It Cm stop
|
2002-11-21 20:12:05 +00:00
|
|
|
If the service is to be started as specified by
|
|
|
|
.Xr rc.conf 5 ,
|
|
|
|
stop the service.
|
2002-11-29 11:39:20 +00:00
|
|
|
This should check that the service is running and complain if it is not.
|
2002-11-21 20:12:05 +00:00
|
|
|
If
|
2002-11-29 11:39:20 +00:00
|
|
|
.Cm forcestop
|
2002-11-21 20:12:05 +00:00
|
|
|
is given, ignore the
|
|
|
|
.Xr rc.conf 5
|
|
|
|
check and attempt to stop.
|
2002-11-29 11:39:20 +00:00
|
|
|
.It Cm restart
|
2002-11-21 20:12:05 +00:00
|
|
|
Perform a
|
2002-11-29 11:39:20 +00:00
|
|
|
.Cm stop
|
2002-11-21 20:12:05 +00:00
|
|
|
then a
|
2002-11-29 11:39:20 +00:00
|
|
|
.Cm start .
|
|
|
|
.It Cm status
|
2002-11-21 20:12:05 +00:00
|
|
|
If the script starts a process (rather than performing a one-off
|
|
|
|
operation), show the status of the process.
|
2002-11-29 11:39:20 +00:00
|
|
|
Otherwise it is not necessary to support this argument.
|
2002-11-21 20:12:05 +00:00
|
|
|
Defaults to displaying the process ID of the program (if running).
|
2002-11-29 11:39:20 +00:00
|
|
|
.It Cm poll
|
2002-11-21 20:12:05 +00:00
|
|
|
If the script starts a process (rather than performing a one-off
|
|
|
|
operation), wait for the command to exit.
|
2002-11-29 11:39:20 +00:00
|
|
|
Otherwise it is not necessary to support this argument.
|
|
|
|
.It Cm rcvar
|
2002-11-21 20:12:05 +00:00
|
|
|
Display which
|
|
|
|
.Xr rc.conf 5
|
|
|
|
variables are used to control the startup of the service (if any).
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
If a script must implement additional commands it can list them in
|
|
|
|
the
|
2002-11-29 11:39:20 +00:00
|
|
|
.Va extra_commands
|
|
|
|
variable, and define their actions in a variable constructed from
|
2002-11-21 20:12:05 +00:00
|
|
|
the command name (see the
|
|
|
|
.Sx EXAMPLES
|
|
|
|
section).
|
|
|
|
.Pp
|
|
|
|
The following key points apply to old-style scripts in
|
2002-11-29 11:39:20 +00:00
|
|
|
.Pa /usr/local/etc/rc.d/ :
|
2000-07-19 19:08:08 +00:00
|
|
|
.Pp
|
2002-11-29 11:39:20 +00:00
|
|
|
.Bl -bullet
|
2000-07-19 19:08:08 +00:00
|
|
|
.It
|
|
|
|
Scripts are only executed if their
|
|
|
|
.Xr basename 1
|
|
|
|
matches the shell globbing pattern
|
|
|
|
.Pa *.sh ,
|
|
|
|
and they are executable.
|
|
|
|
Any other files or directories present within the directory are silently
|
|
|
|
ignored.
|
|
|
|
.It
|
|
|
|
When a script is executed at boot time, it is passed the string
|
2002-11-29 11:39:20 +00:00
|
|
|
.Dq Li start
|
2000-07-19 19:08:08 +00:00
|
|
|
as its first and only argument.
|
|
|
|
At shutdown time, it is passed the string
|
2002-11-29 11:39:20 +00:00
|
|
|
.Dq Li stop
|
2000-07-19 19:08:08 +00:00
|
|
|
as its first and only argument.
|
|
|
|
All
|
2002-11-29 11:39:20 +00:00
|
|
|
.Nm rc.d/
|
2002-08-20 14:43:10 +00:00
|
|
|
scripts are expected to handle these arguments appropriately.
|
2000-07-19 19:08:08 +00:00
|
|
|
If no action needs to be taken at a given time
|
2002-11-29 11:39:20 +00:00
|
|
|
(either boot time or shutdown time),
|
2000-07-19 19:08:08 +00:00
|
|
|
the script should exit successfully and without producing an error message.
|
|
|
|
.It
|
|
|
|
The scripts within each directory are executed in lexicographical order.
|
|
|
|
If a specific order is required,
|
|
|
|
numbers may be used as a prefix to the existing filenames,
|
|
|
|
so for example
|
|
|
|
.Pa 100.foo
|
|
|
|
would be executed before
|
|
|
|
.Pa 200.bar ;
|
|
|
|
without the numeric prefixes the opposite would be true.
|
2002-11-21 20:12:05 +00:00
|
|
|
.It
|
2000-07-19 19:08:08 +00:00
|
|
|
The output from each script is traditionally a space character,
|
|
|
|
followed by the name of the software package being started or shut down,
|
|
|
|
.Em without
|
|
|
|
a trailing newline character (see the
|
|
|
|
.Sx EXAMPLES
|
|
|
|
section).
|
2002-11-21 20:12:05 +00:00
|
|
|
.El
|
2002-11-29 11:39:20 +00:00
|
|
|
.Sh SCRIPTS OF INTEREST
|
1994-05-30 19:09:18 +00:00
|
|
|
When an automatic reboot is in progress,
|
2000-11-20 18:41:33 +00:00
|
|
|
.Nm
|
1994-05-30 19:09:18 +00:00
|
|
|
is invoked with the argument
|
2002-11-29 11:39:20 +00:00
|
|
|
.Cm autoboot .
|
2002-11-21 20:12:05 +00:00
|
|
|
One of the scripts run from
|
2002-11-29 11:39:20 +00:00
|
|
|
.Pa /etc/rc.d/
|
2002-11-21 20:12:05 +00:00
|
|
|
is
|
|
|
|
.Pa /etc/rc.d/fsck .
|
|
|
|
This script runs
|
1994-05-30 19:09:18 +00:00
|
|
|
.Xr fsck 8
|
|
|
|
with option
|
|
|
|
.Fl p
|
2002-11-21 20:12:05 +00:00
|
|
|
and
|
|
|
|
.Fl F
|
2002-11-29 11:39:20 +00:00
|
|
|
to
|
|
|
|
.Dq preen
|
|
|
|
all the disks of minor inconsistencies resulting
|
|
|
|
from the last system shutdown.
|
|
|
|
If this fails, then checks/repairs of serious inconsistencies
|
|
|
|
caused by hardware or software failure will be performed
|
|
|
|
in the background at the end of the booting process.
|
|
|
|
If
|
|
|
|
.Cm autoboot
|
|
|
|
is not set, when going from single-user to multi-user mode for example,
|
|
|
|
the script does not do anything.
|
1994-05-30 19:09:18 +00:00
|
|
|
.Pp
|
2002-07-14 14:58:11 +00:00
|
|
|
The
|
|
|
|
.Nm rc.early
|
|
|
|
script is run very early in the startup process, immediately before the
|
2002-12-12 17:26:04 +00:00
|
|
|
file system check.
|
2002-11-29 11:39:20 +00:00
|
|
|
The
|
2002-11-21 20:12:05 +00:00
|
|
|
.Nm rc.early
|
2002-11-29 11:39:20 +00:00
|
|
|
script is deprecated.
|
|
|
|
Any commands in this
|
2002-11-21 20:12:05 +00:00
|
|
|
file should be separated out into
|
2002-11-29 11:39:20 +00:00
|
|
|
.Nm rc.d/
|
2002-11-21 20:12:05 +00:00
|
|
|
style scripts and integrated into the
|
2002-11-29 11:39:20 +00:00
|
|
|
.Nm
|
2002-11-21 20:12:05 +00:00
|
|
|
system.
|
2002-03-20 09:39:37 +00:00
|
|
|
.Pp
|
2002-07-14 14:58:11 +00:00
|
|
|
The
|
2002-11-29 11:39:20 +00:00
|
|
|
.Pa /etc/rc.d/local
|
2002-11-21 20:12:05 +00:00
|
|
|
script can execute scripts from multiple
|
2002-11-29 11:39:20 +00:00
|
|
|
.Nm rc.d/
|
2002-11-21 20:12:05 +00:00
|
|
|
directories.
|
|
|
|
The default locations are
|
2002-11-29 11:39:20 +00:00
|
|
|
.Pa /usr/local/etc/rc.d/
|
2002-11-21 20:12:05 +00:00
|
|
|
and
|
2002-11-29 11:39:20 +00:00
|
|
|
.Pa /usr/X11R6/etc/rc.d/ ,
|
2002-11-21 20:12:05 +00:00
|
|
|
but these may be overridden with the
|
|
|
|
.Va local_startup
|
|
|
|
.Xr rc.conf 5
|
|
|
|
variable.
|
|
|
|
.Pp
|
|
|
|
The
|
2002-11-29 11:39:20 +00:00
|
|
|
.Pa /etc/rc.d/serial
|
2002-07-14 14:58:11 +00:00
|
|
|
script is used to set any special configurations for serial devices.
|
1998-02-26 02:44:17 +00:00
|
|
|
.Pp
|
2002-07-14 14:58:11 +00:00
|
|
|
The
|
|
|
|
.Nm rc.firewall
|
|
|
|
script is used to configure rules for the kernel based firewall
|
2000-03-03 14:05:08 +00:00
|
|
|
service.
|
|
|
|
It has several possible options:
|
1998-02-26 02:44:17 +00:00
|
|
|
.Pp
|
2002-11-29 11:39:20 +00:00
|
|
|
.Bl -tag -width ".Ar filename" -compact -offset indent
|
|
|
|
.It Cm open
|
|
|
|
will allow anyone in
|
|
|
|
.It Cm client
|
|
|
|
will try to protect just this machine
|
|
|
|
.It Cm simple
|
|
|
|
will try to protect a whole network
|
|
|
|
.It Cm closed
|
|
|
|
totally disables IP services except via
|
|
|
|
.Pa lo0
|
|
|
|
interface
|
|
|
|
.It Cm UNKNOWN
|
|
|
|
disables the loading of firewall rules
|
|
|
|
.It Ar filename
|
1998-02-26 02:44:17 +00:00
|
|
|
will load the rules in the given filename (full path required).
|
|
|
|
.El
|
|
|
|
.Pp
|
2002-07-14 14:58:11 +00:00
|
|
|
The
|
2002-11-29 11:39:20 +00:00
|
|
|
.Pa /etc/rc.d/atm*
|
2002-11-21 20:12:05 +00:00
|
|
|
scripts are used to configure ATM network interfaces.
|
1998-10-06 19:24:31 +00:00
|
|
|
The interfaces are configured in three passes.
|
|
|
|
The first pass performs the initial interface configuration.
|
|
|
|
The second pass completes the interface configuration and defines PVCs and
|
|
|
|
permanent ATMARP entries.
|
|
|
|
The third pass starts any ATM daemons.
|
|
|
|
.Pp
|
2002-11-21 20:12:05 +00:00
|
|
|
Most daemons, including network related daemons, have their own script in
|
2002-11-29 11:39:20 +00:00
|
|
|
.Pa /etc/rc.d/ ,
|
2002-11-21 20:12:05 +00:00
|
|
|
which can be used to start, stop, and check the status of the service.
|
1998-02-26 02:44:17 +00:00
|
|
|
.Pp
|
2002-11-21 20:12:05 +00:00
|
|
|
Any architecture specific scripts, such as
|
|
|
|
.Pa /etc/rc.d/apm
|
|
|
|
for example, specifically check that they are on that architecture
|
|
|
|
before starting the daemon.
|
1998-02-26 02:44:17 +00:00
|
|
|
.Pp
|
2002-11-21 20:12:05 +00:00
|
|
|
Following tradition, all startup files reside in
|
1994-05-30 19:09:18 +00:00
|
|
|
.Pa /etc .
|
2005-01-21 08:36:40 +00:00
|
|
|
.Sh FILES
|
|
|
|
.Bl -tag -compact
|
|
|
|
.It Pa /etc/rc
|
|
|
|
.It Pa /etc/rc.conf
|
|
|
|
.It Pa /etc/rc.conf.local
|
|
|
|
.It Pa /etc/rc.d/
|
|
|
|
.It Pa /etc/rc.firewall
|
|
|
|
.It Pa /etc/rc.local
|
|
|
|
.It Pa /etc/rc.shutdown
|
|
|
|
.It Pa /etc/rc.subr
|
|
|
|
.It Pa /var/run/dmesg.boot
|
2005-01-21 12:01:00 +00:00
|
|
|
.Xr dmesg 8
|
2005-01-21 08:36:40 +00:00
|
|
|
results soon after the
|
|
|
|
.Nm
|
|
|
|
process begins.
|
2005-01-21 12:01:00 +00:00
|
|
|
Useful when
|
|
|
|
.Xr dmesg 8
|
|
|
|
buffer in the kernel no longer has this information.
|
2005-01-21 08:36:40 +00:00
|
|
|
.El
|
2000-07-19 19:08:08 +00:00
|
|
|
.Sh EXAMPLES
|
2002-11-21 20:12:05 +00:00
|
|
|
The following is a minimal
|
2002-11-29 11:39:20 +00:00
|
|
|
.Nm rc.d/
|
|
|
|
style script.
|
|
|
|
Most scripts require little more than the following.
|
2002-11-21 20:12:05 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
|
|
|
|
# PROVIDE: foo
|
|
|
|
# REQUIRE: bar_service_required_to_precede_foo
|
|
|
|
|
2002-11-29 11:39:20 +00:00
|
|
|
\&. /etc/rc.subr
|
2002-11-21 20:12:05 +00:00
|
|
|
|
|
|
|
name="foo"
|
|
|
|
rcvar=`set_rcvar`
|
|
|
|
command="/usr/local/bin/foo"
|
|
|
|
|
|
|
|
load_rc_config $name
|
|
|
|
run_rc_command "$1"
|
|
|
|
.Ed
|
|
|
|
.Pp
|
2002-11-29 11:39:20 +00:00
|
|
|
Certain scripts may want to provide enhanced functionality.
|
|
|
|
The user may access this functionality through additional commands.
|
|
|
|
The script may list and define as many commands at it needs.
|
2002-11-21 20:12:05 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
|
|
|
|
# PROVIDE: foo
|
|
|
|
# REQUIRE: bar_service_required_to_precede_foo
|
|
|
|
# BEFORE: baz_service_requiring_foo_to_precede_it
|
|
|
|
|
2002-11-29 11:39:20 +00:00
|
|
|
\&. /etc/rc.subr
|
2002-11-21 20:12:05 +00:00
|
|
|
|
|
|
|
name="foo"
|
|
|
|
rcvar=`set_rcvar`
|
|
|
|
command="/usr/local/bin/foo"
|
|
|
|
extra_commands="nop hello"
|
|
|
|
hello_cmd="echo Hello World."
|
|
|
|
nop_cmd="do_nop"
|
|
|
|
|
|
|
|
do_nop()
|
|
|
|
{
|
|
|
|
echo "I do nothing."
|
|
|
|
}
|
|
|
|
|
|
|
|
load_rc_config $name
|
|
|
|
run_rc_command "$1"
|
|
|
|
.Ed
|
|
|
|
.Pp
|
2000-07-19 19:08:08 +00:00
|
|
|
As all processes are killed by
|
|
|
|
.Xr init 8
|
|
|
|
at shutdown, the explicit
|
|
|
|
.Xr kill 1
|
|
|
|
is unnecessary, but is often included.
|
1994-05-30 19:09:18 +00:00
|
|
|
.Sh SEE ALSO
|
2000-07-19 19:08:08 +00:00
|
|
|
.Xr kill 1 ,
|
1998-02-26 02:44:17 +00:00
|
|
|
.Xr rc.conf 5 ,
|
1994-05-30 19:09:18 +00:00
|
|
|
.Xr init 8 ,
|
2002-11-21 20:12:05 +00:00
|
|
|
.Xr rcorder 8 ,
|
2004-07-04 20:55:50 +00:00
|
|
|
.Xr rc.subr 8 ,
|
1994-05-30 19:09:18 +00:00
|
|
|
.Xr reboot 8 ,
|
|
|
|
.Xr savecore 8
|
|
|
|
.Sh HISTORY
|
|
|
|
The
|
|
|
|
.Nm
|
2002-07-14 14:58:11 +00:00
|
|
|
utility appeared in
|
1994-05-30 19:09:18 +00:00
|
|
|
.Bx 4.0 .
|