Managing HP Serviceguard A.11.20.10 for Linux, December 2012

{
sg_log 5 "start_command"
# ADD your service start steps here
return 0
}
#########################################################################
#
# stop_command
#
# This function should define actions to take when the package halts
#
#
#########################################################################
function stop_command
{
sg_log 5 "stop_command"
# ADD your halt steps here
exit 1
}
################
# main routine
################
sg_log 5 "customer defined monitor script"
#########################################################################
#
# Customer defined monitor script should be doing following
# functionality.
#
# When the package is halting, cmhaltpkg will issue a SIGTERM signal to
# the service(s) configured in package. Use SIGTERM handler to stop
# the monitor script.
#
# Monitor the generic resource configured in package using customer
# defined tools and set the status or value to generic resource by using
# "cmsetresource" command. When setting the status or value get the current
# status or value using "cmgetresource" and set only if they are different.
#
#########################################################################
start_command $*
# SIGTERM signal handler to stop the monitor script
trap "stop_command" $SIGTERM
while [ 1 ]
do
# Using customer defined tools get the status or value
# of generic resource(s) which are configured in package.
# Set the status or value of the generic resource using
# "cmsetresource" command. Before setting the stauts or value
# compare the new status or value by getting the existing status or
# value using "cmgetresource" and set only if they are different.
# Wait for customer defined interval to check the status or value
# for next time.
G.2 Template of a Monitoring Script 293