HP-UX Containers (SRP) A.03.01 Administrator's Guide
55
11 Container startup and shutdown
The HP-UX Containers startup and shutdown script (/sbin/init.d/srp) executes when the system
transitions to run level 3 during startup, and executes when the system transitions down to run level 2
during shutdown. The following startup and shutdown scripts are linked to /sbin/init.d/srp:
/sbin/rc3.d/S999srp
/sbin/rc2.d/K001srp
Containers that are configured to autostart will be started when the /sbin/rc3.d/S999srp script is
run at system startup. You can start any container manually using the srp –start command after
the system has reached run level 3. During system shutdown, the /sbin/rc2.d/K001srp script is
run, which will automatically stop all containers that are started.
Container startup and shutdown works similarly to the system startup and shutdown. Each container
home directory contains a run level subtree hierarchy at /var/hpsrp/container_name/sbin
similar to the system /sbin subtree, and includes the directories init.d, rc0.d, rc1.d, rc2.d,
rc3.d, and rc4.d. When the container’s srp_init daemon is launched on startup, it processes
the container inittab(4) file and spawns the configured run level entries for the startup run level
(run level 3). One of the default /etc/inittab entries is /sbin/srp_rc, which is similar to the
/sbin/rc script, which invokes the scripts configured in the run level subtree in the container /sbin
directory. See rc(1M) for more information.
When you execute either
srp –start container_name or srp –stop container_name:
• In the case of –start, the srp command launches srp_init inside the container and
srp_init transitions from run level 0 to the default run level specified in the container’s
/etc/inittab file. In the case of –stop, the srp command instructs srp_init to
transition from the container’s current run level, down to run level 0.
• For each run level, srp_init runs the /sbin/srp_rc inittab entry, which executes the
scripts in the container’s /etc/rcN.d directory in alphanumeric order (where N is a run
level number). When the container starts, srp_rc traverses the rc directories in ascending
order and executes the scripts in the directories. When the container shuts down, srp_rc
traverses the rc directories in descending order and executes the scripts in the directories.
Under normal circumstances, the container’s run level processing handles terminating any remaining
user processes via the /sbin/rc0.d/K800killall script. If there are any processes still running
in the container after all run-level processing is completed, the srp command will forcibly terminate
all the remaining processes. If after repeated attempts one or more processes still remain in the
container, the stop operation will fail.
You can automate the activities that you want performed when a container is started or stopped by
adding your startup/shutdown scripts in the container rcN directories. HP recommends that you
follow the practices recommended in the rc(1M) man page for creating and deploying your start
and shutdown scripts.
NOTE: Container run level is independent of system run level. Containers cannot be started on the
system until the system level init daemon has reached run level 3.