Managing HP Serviceguard A.11.20.10 for Linux, December 2012

: # 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
7.7.2.2.1 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.
To avoid this situation, it is a good idea to always specify a RUN_SCRIPT_TIMEOUT and a
HALT_SCRIPT_TIMEOUT for all packages, especially packages that use Serviceguard commands
in their control scripts. If a timeout is not specified and your configuration has a command loop
as described above, inconsistent results can occur, including a hung cluster.
7.7.2.3 Support for Additional Products
The package control script template provides exits for use with additional products, including
Serviceguard Extended Distance Cluster (serviceguard-xdc) for Linux. Refer to the additional
product’s documentation for details about how to create a package using the hooks that are
provided in the control script.
7.7.3 Verifying the Package Configuration
Serviceguard checks the configuration you created and reports any errors.
For legacy packages, you can do this in Serviceguard Manager: click Check to verify the package
configuration you have done under any package configuration tab, or to check changes you have
made to the control script. Click Apply to verify the package as a whole. See the local Help for
more details.
If you are using the command line, use the following command to verify the content of the package
configuration you have created:
cmcheckconf -v -P $SGCONF/pkg1/pkg1.conf
Errors are displayed on the standard output. If necessary, edit the file to correct any errors, then
run the command again until it completes without errors.
7.7 Configuring a Legacy Package 229