#!/bin/ksh
#  ALTRAN_PROLOG_BEGIN_TAG
#  This is an automatically generated prolog.
#
#  Copyright (C) Altran ACT S.A.S. 2017,2021.  All rights reserved.
#
#  ALTRAN_PROLOG_END_TAG
#
# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
#  
# 61haes_r714 src/43haes/usr/sbin/cluster/events/cluster_notify.sh 1.8 
#  
# Licensed Materials - Property of IBM 
#  
# COPYRIGHT International Business Machines Corp. 2004,2007 
# 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/cluster_notify.sh, 726, 2147A_aha726, Feb 05 2021 09:50 PM

#########################################################################
#
#   COMPONENT_NAME: EVENTS
#
#   FUNCTIONS: getMessage()
#
#########################################################################
###############################################################################
#  Name:  getMessage
#
#  This routine echos the message to display. This is to be updated to include i
#  new messages every time the new usage of cluster_notify event occurs.
#
#  Arguments:    Message index, parameters
#  Usage:        getMessage MsgIdx, parameter
#  Returns:      Nothing, Echos the message.
#
###############################################################################
getMessage()
{
    typeset PS4_FUNC="getMessage"
    ID=$1
    NODE=$2

    if [[ -n $ID ]]; then
    	case "$ID"
    	in
		1) echo $(dspmsg scripts.cat 9680 "clverify has detected cluster \n\
configuration errors on node %s. Detailed clverify output is available in \n\
standard clverify log on node %s.\n" $NODE $NODE)
		;;
		*) echo $(dspmsg scripts.cat 8066 "Unrecognized message id %s.\n" $ID)
		;;
    	esac
   fi

}



#########################################################################
#                                                                       #
#       Name:           cluster_notify                                  #
#                                                                       #
#	Description:	This event script is called when a cluster	#
#			notification have been requested.		#
#									#
#       Called by:      cluster manager	 				#
#                                                                       #
#       Calls to:       None						#
#                                                                       # 
#       Argument:       Message ID (number of the message to display)	#
#                                                                       #
#       Returns:        0       success                                 #
#                                                                       #
#########################################################################

PROGNAME=${0##*/}
export PATH="$(/usr/es/sbin/cluster/utilities/cl_get_path all)"

if [ $# -ne 2 ]
then
        cl_echo 8065 "Usage: $PROGNAME nodename message_id\n" $PROGNAME
        exit 0
fi

MESSAGE="$(getMessage $2 $1)"
echo "$(getMessage $2 $1)"
exit 0
