#!/bin/ksh93
#  ALTRAN_PROLOG_BEGIN_TAG
#  This is an automatically generated prolog.
#
#  Copyright (C) Altran ACT S.A.S. 2020,2021.  All rights reserved.
#
#  ALTRAN_PROLOG_END_TAG
#
# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
#  
# 61haes_r721 src/43haes/usr/sbin/cluster/events/check_for_site_up.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 

# @(#)  7d4c34b 43haes/usr/sbin/cluster/events/check_for_site_up.sh, 726, 2147A_aha726, Feb 05 2021 09:50 PM

#########################################################################
#                                                                       #
#       Name:           check_for_site_up                               #
#                                                                       #
#       Description:    This event script is called from the node_up    #
#                       recovery program to determine if a site_up      #
#                       event should be launched.                       #
#                                                                       #
#       Called by:      node_up recovery program                        #
#                                                                       #
#       Calls to:       clcallev()                                      #
#                                                                       #
#       Arguments:      node name and start mode (same as node_up)      #
#                                                                       #
#       Returns:        exit code from site_up                          #
#                                                                       #
#########################################################################

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

#
# If here we need to run the site_up 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='%I%'
fi

NODENAME=$1
typeset START_MODE=""
if (( $# > 1 )) && [[ $2 == "forced" ]]
then
    START_MODE="forced"
fi

#
# clstrmgr sets GENERATE_SITE_UP=<site name>
#
clcallev site_up $GENERATE_SITE_UP $START_MODE

exit $?

