| RC(8) | System Manager's Manual | RC(8) |
NAME
rc, rc.shutdown,
rc.d — system startup and
shutdown scripts
SYNOPSIS
/sbin/init_sh /etc/rc
[autoboot] |
/sbin/init_sh /etc/rc.shutdown |
/etc/rc.d/service
command |
DESCRIPTION
/etc/rc starts the system's services when
it comes up to multi-user mode. init(8)
runs it with the argument autoboot when the system
boots unattended. It loads the settings in
rc.conf(5), orders the scripts in
/etc/rc.d and
/usr/local/etc/rc.d with
rcorder(8), leaving out those with
the keyword nostart, and runs each with the command
faststart (quietstart when
not booting). A script that fails is reported on the console and the boot
continues; only a failure of /etc/rc itself makes
init(8) fall back to single-user
mode.
/etc/rc.shutdown stops services before the
system goes down. It runs the scripts that have the keyword
shutdown, in the reverse of their start order, with
the command faststop.
init(8) stops it after
rcshutdown_timeout seconds.
Each script in /etc/rc.d manages one service, and is run by init_sh(8). It may be written with the rc.subr(8) functions, in the style of FreeBSD scripts, or as an init_sh(8) service block. Its commands are
start- Start the service, if it is enabled in rc.conf(5).
stop- Stop the service.
restart- Stop the service, then start it.
status- Report whether the service is running; exit 0 if it is.
rcvar- Print the rc.conf(5) variable that enables the service, and its value.
enabled- Exit 0 if the service is enabled.
A script may define more commands. A command may be prefixed with
one, to run it even if the service is disabled;
force, to also ignore failed preconditions;
quiet, to omit some messages; or
fast, to skip the check for an already running
service.
The scripts FILESYSTEMS, NETWORKING, SERVERS, DAEMON and LOGIN do nothing; they provide points in the boot that other scripts can require.
FILES
- /etc/rc
- the startup script
- /etc/rc.shutdown
- the shutdown script
- /etc/rc.d/
- the base system's service scripts
- /usr/local/etc/rc.d/
- service scripts for added software
- /etc/rc.conf
- settings; see rc.conf(5)
- /etc/defaults/rc.conf
- default settings
EXAMPLES
# /etc/rc.d/hostname status # /etc/rc.d/cron onestart
SEE ALSO
rc.conf(5), ttys(5), init(8), init_sh(8), rc.subr(8), rcorder(8), shutdown(8)
HISTORY
The rc script appeared in
Version 6 AT&T UNIX. The
rc.d system first appeared in
NetBSD 1.5.
| September 25, 2026 | OxideBSD |