Managing Systems and Workgroups: A Guide for HP-UX System Administrators
Administering a System: Booting and Shutdown
Customizing Start-up and Shutdown
Chapter 5 515
Customizing Start-up and Shutdown
This section explains how to make applications and services start
automatically on boot and stop on shutdown.
To automate starting and stopping a subsystem you need to do all of the
following:
1. Decide at what run level(s) you want the subsystem to start and stop.
Typically, subsystems get stopped at one run level lower than the one
they were started in, so a subsystem started at run level 3 will be
stopped at run level 2. You will probably want to start your
subsystem at level 1, 2 or 3.
Generally, these run levels perform the following functions:
Run level 1: minimal system configuration
Run level 2: multi-user services, except NFS server
Run level 3: NFS server (to export local file systems)
For details, see the HP-UX 10.0 File System Layout White Paper on
http://docs.hp.com.
To see exactly what is being started on your system at each run level,
look at /sbin/rc
n
.d/S*, where
n
is the run level.
Unless your subsystem depends on NFS-export services such as
rpc.mountd and nfsd, run level 2 is a good place to start it.
Run level 2 is a safe, as well as usually a logical, choice because it
has a place-holder which HP guarantees will not be overwritten by
future releases of HP or third-party software; there is no such
place-holder, and hence no such guarantee, at the other run levels.
2. Write a script to start and stop the subsystem, and an accompanying
configuration script to tell the boot process whether or not this script
should be run.
Use the template /sbin/init.d/template; see the example below.
3. Create symbolic links that will cause your script to be run at the
right place in the boot and shutdown sequences.
See the example below.