DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

rc0(ADM)


rc0 -- run commands performed to stop the operating system

Syntax

/etc/rc0

Description

This file is executed at each system state change that needs to have the system in an inactive state. It is responsible for those actions that bring the system to a quiescent state, traditionally called ``shutdown.''

One system state requires this procedure: state 0 (the system halt state). Whenever a change to this state occurs, the /etc/rc0 procedure is run. The entry in /etc/inittab might read:

   s0:0:wait:/etc/rc0 >/dev/console 2>&1 </dev/console
Some of the actions performed by /etc/rc0 are carried out by files in the directory /etc/shutdown.d and files beginning with ``K'', ``S'', ``P'', and ``I'' in /etc/rc0.d. These files are executed in ASCII order (see ``Files'' below for more information), terminating a system service. The combination of commands in /etc/rc0 and files in /etc/shutdown.d and /etc/rc0.d determines how the system is shut down.

The recommended sequence for /etc/rc0 is:

  1. Stop system services and daemons.

    Various system services (such as the lp spooler) are gracefully terminated.

    When new services are added that should be terminated when the system is shut down, the appropriate files are installed in /etc/shutdown.d and /etc/rc0.d.

  2. Terminate processes.

    SIGTERM signals are sent to all running processes by killall(ADM). Processes stop themselves cleanly if sent SIGTERM.

  3. Kill processes.

    SIGKILL signals are sent to all remaining processes; no process can resist SIGKILL.

    At this point the only processes left are those associated with /etc/rc0 and processes 0 and 1, which are special to the operating system.

  4. Unmount all filesystems.

    Only the root filesystem (/) remains mounted.

Warning

This file is intended for execution by init. It should not be executed by the user under any circumstances.

Files

The execution by /bin/sh of any files in /etc/shutdown.d occurs in ASCII sort-sequence order.

The files in /etc/rc0.d are run in the order when sorted on their filenames from the second character onward (according to the ASCII collation sequence). The first character of the filename determines how the files are run on entering run level 0:


K*
scripts executed in serial sequence of their sort order when stop is specified to prc_sync(ADM)

S*
scripts executed in serial sequence of their sort order when start is specified to prc_sync

P*
scripts which prc_sync executes in parallel with other P* scripts to which they are adjacent when sorted

I*
interactive scripts for which prc_sync will wait until they complete executing and exit
Files beginning with other characters are ignored.

Important scripts in /etc/rc0.d are:


P00ANNOUNCE
announces system services are being stopped

P70uucp
cleans up uucp locks, status, and temporary files

P75cron
stops the cron(C) daemon

See also

killall(ADM), prc_sync(ADM), rc2(ADM), shutdown(ADM)
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 03 June 2005