RC(8) — UNIX Programmer’s Manual
V= $Header: /usr/src/dynix.3.2.0/src/doc/man8/RCS/rc.8,v 1.4 1993/03/19 04:37:10 bruce Exp $
NAME
rc.boot, rc, rc.local, rc.shutdown, rc.single − command scripts for auto-reboot, daemons, shutdown, and single-user mode
SYNOPSIS
/etc/rc.boot
/etc/rc
/etc/rc.local
/etc/rc.shutdown
/etc/rc.single
DESCRIPTION
The command script rc.boot is executed whenever the machine is booted. The script rc controls the automatic reboot process. The script rc.local holds site-specific commands. The script rc.shutdown controls shutdowns, halts, and the shutdown portion of manual reboots. The rc.single script holds commands to be run when the machine goes into single-user (whether booted that way, or brought down from multi-user mode).
The script rc.boot, if it exists, is executed by init whenever the machine is booted. By default, rc.boot does not exist. It could be used to do one-time initializations, such as configuring network interfaces.
If booting to single-user mode, init then executes rc.single, if it exists, and starts a single-user shell.
When an automatic reboot is in progress (i.e., booting to multi-user mode), rc is invoked with the argument autoboot. It runs fsck with the −p option to “preen” all the disks of minor inconsistencies resulting from the last system shutdown, and to check for serious inconsistencies caused by hardware or software failure. If this auto-check and repair fails, then the machine is left in single-user mode.
The second part of rc runs after the first part succeeds, and also when rc is invoked by virtue of a single-user shell terminating (refer to the init(8) man page). This part executes rc.local (described below), starts additional swap devices, preserves editor files, clears the scratch directory /tmp, and starts daemons on the system.
Normally, the first part of rc.local uses domainname to define the machine’s domain name, starts up local daemons, and uses savecore to save any core image generated as a result of a system crash. The savecore command is included in the rc.local file because the directory in which core dumps are saved is usually site-specific. The rc.local script also defines the machine’s hostname using hostname and configures network interfaces using ifconfig.
The script rc.shutdown is always called with a single argument. It is called from shutdown, halt, and reboot.
The shutdown command calls rc.shutdown with the argument warn immediately before it sends the terminate signal (SIGTERM) to all non-system processes. This part of the script can be used by the system administrator to turn off databases and other system-wide applications that need to shut down gracefully. (Refer to the shutdown(8) man page for details of the sequence of events during system shutdown). After shutdown sends all processes a kill signal (SIGKILL), it calls rc.shutdown with the argument shutdown. This part of the rc.shutdown script handles any shutdown procedure that requires most processes to be gone, such as unmounting disks. The only processes alive at this point are the system processes (init, swapper, pagedaemon), shutdown, a shell for rc.shutdown, and any processes that did not die, if any.
The halt command calls rc.shutdown with the argument halt before halting the last processor, and reboot similarly calls rc.shutdown with the argument reboot before the system is rebooted.
When the system is booted in single-user mode, and when the system is brought down from multi-user mode into single-user mode, rc.single is executed if it exists. By default this script initializes the hostname and domainname of the system, based on the hostname and domainname settings in rc.local.
SEE ALSO
halt (8), init (8), reboot (8), savecore (8), shutdown (8), fsck (8), domainname (8), hostname (8), ifconfig (8)
4BSD