#!/usr/bin/ksh93 # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # 61haes_r714 src/43haes/usr/sbin/cluster/sa/db2/sbin/cl_db2node.sh 1.2 # # Licensed Materials - Property of IBM # # Restricted Materials of IBM # # COPYRIGHT International Business Machines Corp. 2005 # 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 # @(#)43 1.2 src/43haes/usr/sbin/cluster/sa/db2/sbin/cl_db2node.sh, hacmp.assist, 61haes_r714 2/25/05 14:27:34 # Read in the message catalog entries . /usr/es/sbin/cluster/sa/db2/cat/cl_db2node # Read in the DB2 defaults . /usr/es/sbin/cluster/sa/db2/etc/db2_definitions # Load the common functions, logmsg, dbgmsg, errmsg, abort . /usr/es/lib/ksh93/common_functions.ksh93 umask -S u=rw,g=,o= KLIB=/usr/es/lib/ksh93 FPATH=$KLIB/hacmp PATH=$PATH:/usr/es/sbin/cluster/utilities:/usr/es/sbin/cluster:/usr/es/sbin/cluster/sa/db2/sbin/ if set -- $(getopt g:n:ra $* 2>&1); then while [ $# != 0 ]; do case "$1" in -g) # Store the resource group name RG=$2 shift ;; -a) # Add the specified node ACTION="ADD" ;; -r) # Remove the specified node ACTION="REMOVE" ;; -n) # Node to add or remove NODE=$2 shift ;; --) shift break ;; esac shift done fi if [[ -z $RG ]]; then # Show the usage statement abort 1 $SCRIPT_NAME fi if [[ "$ACTION" == "ADD" ]]; then if [[ -z $NODE ]]; then abort 2 $RG fi # # Check to ensure the node doesn't already exist in the group # KLIB_HACMP_is_node_in_group $RG $NODE if (( $? == 0 )); then abort 3 $NODE $RG fi # # If the node is not known to the hacmp configuration, then add it # KLIB_HACMP_is_known_node $NODE if (( $? != 0 )); then errmsg 4 $NODE new_node=$(KLIB_HACMP_discover_nodes $DB2_DEFAULT_CLUSTER_NAME NODE) if [[ -z "$new_node" ]]; then abort 5 $NODE $RG $NODE fi fi KLIB_HACMP_add_node_to_group $RG $NODE if (( $? != 0 )); then abort 6 $NODE $RG fi errmsg 7 $NODE $RG exit 0 fi if [[ "$ACTION" == "REMOVE" ]]; then if [[ -z $NODE ]]; then abort 8 $RG fi KLIB_HACMP_remove_node_from_group $RG $NODE if (( $? != 0 )); then abort 9 $NODE $RG fi errmsg 10 $NODE $RG exit 0 fi # Show the usage statement abort 1 $SCRIPT_NAME