Managing Serviceguard 13th Edition, February 2007

Configuring Packages and Their Services
Creating the Package Control Script
Chapter 6 289
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.
An example of this portion of the script is shown below, with the date
and echo commands included to log starts and halts of the package to a
special file.
# START OF CUSTOMER DEFINED FUNCTIONS
# This function is a place holder for customer defined functions.
# You should define all actions you want to happen here, before the service is
# started. You can create as many functions as you need.
function customer_defined_run_cmds
{
# ADD customer defined run commands.
: # do nothing instruction, because a function must contain some command.
date >> /tmp/pkg1.datelog