HP-UX Secure Resource Partitions (SRP) A.02.01 Administrator's Guide

99
Appendix B SRP Serviceguard Default Route Script
The following script can be used by a Serviceguard package to assign a default route for an IP
address associates with an SRP. This script is included with the SRP Serviceguard Reference
Implementation and is installed with the SRP product at:
/opt/hpsrp/example/serviceguard/srp_as_sg_package/srp_route_script
# Copyright (c) 2009 Hewlett-Packard Development Company L.P.
#
# This script runs the 'route' command to manage source based routing
entry
# for the SRP.
#
# This script should be configured into the package configuration file
# as the first "external_script" parameter entry. It will be executed
# right after Serviceguard IP addresses assignment during package start
time,
# and before removing IP addresses during package halt time.
#
# This script uses the environment variable SRP_SG_MANAGED_IP and
# SRP_SG_GATEWAY. The environment variables must be set in the
# srp_script.incl file in the same directory as this script.
#
###########################
# Source utility functions.
###########################
if [[ -z $SG_UTILS ]]
then
. /etc/cmcluster.conf
SG_UTILS=$SGCONF/scripts/mscripts/utils.sh
fi
if [[ -f ${SG_UTILS} ]]; then
. ${SG_UTILS}
if (( $? != 0 ))
then
echo "ERROR: Unable to source package utility functions file:
${SG_UTILS}"
exit 1
fi
else
echo "ERROR: Unable to find package utility functions file:
${SG_UTILS}"
exit 1
fi
###################################################################
#
# Get the environment for this package through utility function
# sg_source_pkg_env().
#
###################################################################
sg_source_pkg_env $*