HP-UX Reference (11i v2 04/09) - 1M System Administration Commands N-Z (vol 4)

r
rc(1M) rc(1M)
Scripts are executed in alphabetical order. The entire file name of the script is used
for alphabetical ordering purposes.
When ordering start and kill script links, note that subsystems started in any given
order should be stopped in the reverse order to eliminate any dependencies between
subsystems. This means that kill scripts will generally not have the same numbers
as their start script counterparts. For example, if two subsystems must be started
in a given order due to dependencies (e.g.,
S111house followed by
S222uses_house
), the kill counterparts to these scripts must be numbered so
that the subsystems are stopped in the opposite order in which they were started
(e.g.,
K555uses_house
followed by K777house).
Also keep in mind that kill scripts for a start script in directory
/sbin/rcN.d
will reside in /sbin/rc(N-1).d. For example,
/sbin/rc3.d/S123homer
and /sbin/rc2.d/K654homer
might be start/kill counterparts.
Arguments
The startup/shutdown scripts should be able to recognize the following four arguments (where applica-
ble):
start The start argument is passed to scripts whose names start with
S. Upon receiv-
ing the
start argument, the script should perform its start actions.
stop The stop argument is passed to scripts whose names start with K. Upon receiving
the stop argument, the script should perform its stop actions.
start_msg The start_msg argument is passed to scripts whose names start with S so that
the script can report back a short message indicating what the start action will do.
For instance, when the lp spooler script is invoked with a start_msg argument,
it echoes
Starting the LP subsystem
This string is used by the startup routines. Scripts given just the start_msg
argument will only print a message and not perform any actions.
stop_msg The stop_msg argument is passed to scripts whose names start with K so that the
script can report back a short message indicating what the stop action will do. For
instance, when the lp spooler script is invoked with a stop_msg argument, it
echoes
Stopping the LP subsystem
This string is used by the shutdown checklist. Scripts given just the stop_msg
argument will only print a message and not perform any actions.
Script Output
To ensure proper reporting of startup events, startup scripts are required to comply with the following
guidelines for script output.
Status messages, such as
starting house daemon
must be directed to stdout. All error messages must be directed to stderr.
Script output, both stdout and stderr, is redirected to log file
/etc/rc.log, unless the startup
checklist mode is set to the raw mode. In this case, all output goes to the console. All error mes-
sages should be echoed to stdout or stderr.
Startup scripts are not allowed to send messages directly to the console, or to start any daemons
that immediately write to the console. This restriction exists because these scripts are now
started by the
/sbin/rc checklist wrapper. All script output should go to either stdout or
stderr, and thus be captured in a log file. Any console output will be garbled.
When a startup script returns an exit code of
3, /sbin/rc can display a specific message on the
console prior to rebooting the system. This is achieved by creating a text file named
/etc/rc.bootmsg containing the text to be displayed to the console. Note that /sbin/rc
deletes this file after displaying the message, so startup scripts need to write this file each time a
specific message is required to be displayed on console prior to reboot.
HP-UX 11i Version 2: September 2004 2 Hewlett-Packard Company Section 1M669