Managing Serviceguard 11th Edition, Version A.11.16, Second Printing June 2004

Configuring Packages and Their Services
Writing the Package Control Script
Chapter 6 269
# HA_NFS_SCRIPT_EXTENSION is set to "package1.sh", for example, the name
# of the HA NFS script becomes "ha_nfs.package1.sh". In any case,
# the HA NFS script must be placed in the same directory as the package
# control script. This allows multiple packages to be run out of the
# same directory, as needed by SGeSAP.
#HA_NFS_SCRIPT_EXTENSION=""
The above excerpt from the control script shows the assignment of values
to a set of variables. The remainder of the script uses these variables to
control the package by executing Logical Volume Manager commands,
HP-UX commands, and Serviceguard commands including cmrunserv,
cmmodnet, and cmhaltserv. Examine a copy of the control script
template to see the flow of logic. Use the following command:
# cmmakepkg -s | more
The main function appears at the end of the script.
Note that individual variables are optional; you should include only as
many as you need for proper package operation. For example, if your
package does not need to activate a volume group, omit the VG variables;
if the package does not use services, omit the corresponding
SERVICE_NAME, SERVICE_CMD, and SERVICE_RESTART variables; and so
on.
If you have defined an EMS resource in the package configuration file
that is labeled as DEFERRED, you need to define a
DEFERRED_RESOURCE_NAME in the package control script. Specify only the
deferred resources, using the DEFERRED_RESOURCE_NAME parameter:
DEFERRED_RESOURCE_NAME[0]="/net/interfaces/lan/status/lan0"
DEFERRED_RESOURCE_NAME[1]="/net/interfaces/lan/status/lan1"
After customizing the script, distribute it to each node in the cluster
using rcp, ftp, or your favorite method of copying.
Adding Customer Defined Functions to the Package
Control Script
You can add additional shell commands to the package control script to
be executed whenever the package starts or stops. Simply enter these
commands in the CUSTOMER DEFINED FUNCTIONS area of the script. This
gives you the ability to further customize the control script.