#!/bin/ksh93
# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
#  
# 61haes_r721 src/43haes/usr/sbin/cluster/events/check_for_site_down.sh 1.4.1.1 
#  
# Licensed Materials - Property of IBM 
#  
# Restricted Materials of IBM 
#  
# COPYRIGHT International Business Machines Corp. 2001,2016 
# All Rights Reserved 
#  
# US Government Users Restricted Rights - Use, duplication or 
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp. 
#  
# IBM_PROLOG_END_TAG 

# "@(#)16   1.4.1.1   src/43haes/usr/sbin/cluster/events/check_for_site_down.sh, hacmp.events, 61haes_r721, 1612B_hacmp721 3/7/16 12:47:26"
 
#########################################################################
#                                                                       #
#       Name:           check_for_site_down                             #
#                                                                       #
#       Description:    This event script is called from the node_down  #
#                       recovery program to determine if a site_down    #
#                       event should be launched.                       #
#                                                                       #
#       Called by:      node_down recovery program                      #
#                                                                       #
#       Calls to:       clcallev()                                      #
#                                                                       #
#       Arguments:      none                                            #
#                                                                       #
#       Returns:        0       success                                 #
#                       1       failure                                 #
#                       2       bad argument                            #
#                                                                       #
#########################################################################

if [[ -z "$GENERATE_SITE_DOWN" ]]
then
    : GENERATE_SITE_DOWN is not set - do not generate site_down
    exit 0
fi

#
# If here we need to run the site_down event - do some setup and call it
#
PROGNAME=${0##*/}
export PATH="$(/usr/es/sbin/cluster/utilities/cl_get_path all)"
eval export $(cllsparam -x)

if [[ "$VERBOSE_LOGGING" == "high" ]] 
then
    set -x
    version='1.4.1.1'
fi

#
# clstrmgr sets GENERATE_SITE_DOWN=<site name>
#
if ! clcallev site_down $GENERATE_SITE_DOWN
then
    exit 1
fi
exit 0
