HP Serviceguard Developer's Toolbox Version B.12.00.00 For HP-UX and Linux

This script is used by the Serviceguard master control script to start and stop packages that are
created using the Toolbox. You can modify the monitor function, if required.
###########################
# Source utility functions.
###########################
. /etc/cmcluster.conf
if [[ -z $SG_UTILS ]]; then
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().
#
##################################################################
# export PATH=$PATH:$SGSBIN
sg_source_pkg_env $*
#
#################################################################
#
# VALIDATE FUNCTION
#
#################################################################
function validate_function
{
sg_log 0 "App Toolkit validation"
for i in `set | grep "^APP_TKIT_"`
do
name=`echo $i | awk -F"=" '{print $1}'`
value=`echo $i | awk -F"=" '{for(i=2;i<=NF;i++)printf "%s ",$i;print ""}'`
case $name in
APP_TKIT_MAINTENANCE_FLAG)
validate_yes_no $name $value
;;
*)
validate_not_empty $name $value
;;
esac
done
}
##################################################################
#
#
VALIDATE YES NO FUNCTION
#
#################################################################
function validate_yes_no
{
if [[ $# < 2 ]]; then
sg_log 0 "Usage : check_yes_or_no VAR VALUE";
sg_log 0 "ERROR: $1 is not defined";
check_return 1 5
fi
if [ -z "$2" ]; then
arg="invalid"
else
arg=`echo $2 | tr "[:upper:]" "[:lower:]" | tr -d "[:space:]"`
fi
case $arg in
yes)
return 0;
;;
no)
return 0;
;;
*)
sg_log 0 "Invalid option $1=$2.\n$1 can be set either as $1=\"yes\" or
$1=\"no\"."
check_return 1 5
29