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/consoleSome 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:
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.
SIGTERM signals are sent to all running processes by killall(ADM). Processes stop themselves cleanly if sent SIGTERM.
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.
Only the root filesystem (/) remains mounted.
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:
Important scripts in /etc/rc0.d are: