Managing Serviceguard 14th Edition, June 2007

Cluster and Package Maintenance
Configuring a Legacy Package
Chapter 7 371
# 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.
# You should define all actions you want to happen here, before the service is
# halted.
function customer_defined_halt_cmds
{
# ADD customer defined halt commands.
: # do nothing instruction, because a function must contain some command.
date >> /tmp/pkg1.datelog
echo 'Halting pkg1' >> /tmp/pkg1.datelog
test_return 52
}
# END OF CUSTOMER DEFINED FUNCTIONS
Adding Serviceguard Commands in Customer Defined
Functions You can add Serviceguard commands (such as cmmodpkg) in
the Customer Defined Functions section of a package control script.
These commands must not interact with the package itself.
If a Serviceguard command interacts with another package, be careful to
avoid command loops. For instance, a command loop might occur under
the following circumstances. Suppose pkg1 does a cmmodpkg -d of pkg2,
and pkg2 does a cmmodpkg -d of pkg1. If both pkg1 and pkg2 start at the
same time, pkg1 tries to cmmodpkg pkg2. However, that cmmodpkg
command has to wait for pkg2 startup to complete. pkg2 tries to
cmmodpkg pkg1, but pkg2 has to wait for pkg1 startup to complete,
thereby causing a command loop.