Managing HP Serviceguard for Linux, Sixth Edition, August 2006

Configuring Packages and Their Services
Writing the Package Control Script
Chapter 6202
Linux 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.
After customizing the script, distribute it to each node in the cluster
using scp, 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
echo 'Starting pkg1' >> /tmp/pkg1.datelog
test_return 51
}
# This function is a place holder for customer defined functions.