#!/bin/ksh # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # 61haes_r714 src/43haes/usr/sbin/cluster/events/utils/cl_start_x25_link.sh 1.6 # # Licensed Materials - Property of IBM # # COPYRIGHT International Business Machines Corp. 2002,2004 # 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 # @(#)84 1.6 src/43haes/usr/sbin/cluster/events/utils/cl_start_x25_link.sh, hacmp.hawan, 61haes_r714 7/14/04 13:47:55 ## ## Script: cl_start_x25_link ## ## Syntax: ## cl_start_x25_link ## ## Called-by: clcommlinkd ## ## Parameters: type = HACMP communications link type ## driver = the AIX system name for the driver to use ## examples: hdlc0, hdlc1, twd0, twd1, etc. ## driver_port = the port number for a twd driver ## port = the AIX system name for the SX25 port ## examples: sx25a0, sx25a1, etc. ## local_nua = the local nua designation for the link ## network_id = the network id the link is connected to ## country_code = the country code for the network ## ## Return: 0 on success, 1 on failure, 2 on usage error ## PROGNAME=$(basename ${0}) export PATH="$($(dirname ${0})/../../utilities/cl_get_path all)" [[ "$VERBOSE_LOGGING" = "high" ]] && set -x [[ "$VERBOSE_LOGGING" = "high" ]] && version='1.6' HA_DIR="$(cl_get_path)" echo "Starting execution of $0 with parameters $*" TYPE=$1 DRIVER=$2 PORT=$3 NUA=$4 DRIVER_PORT=$5 NETID=$6 CCODE=$7 set -u # are all required parameters present? if [[ -z "$TYPE" || -z "$DRIVER" || -z "$PORT" || -z "$NUA" ]] then echo "$PROGNAME: usage" echo " cl_start_x25_link \\" echo " [driver port] [network_id] [country_code]" exit 2 fi # is the type correct? if [[ "$TYPE" != *x25 ]] then echo "$PROGNAME: invalid link type: $TYPE" exit 2 fi # is a PORT specified for the twd driver? if [[ "$DRIVER" = twd* ]] then if [[ -n "$DRIVER_PORT" ]] then ADD_ON_PORT="-p $DRIVER -w $DRIVER_PORT" else cl_echo 7702 "A port must be specified for driver $DRIVER." "$DRIVER" exit 1 fi else ADD_ON_PORT="-a nddname=$DRIVER" fi # double check to make sure the driver is available DRIVER_STATE=`lsdev -C -l $DRIVER | awk '{ print $2 }'` if [[ -z $DRIVER_STATE ]] then # does this one need an NLS message? cl_echo 7703 "Driver $DRIVER is not defined." "$DRIVER" exit 1 elif [[ "$DRIVER_STATE" = "Defined" ]] then # assume the setting are OK and make driver available mkdev -l $DRIVER if [ $? -ne 0 ] then # does this one need an NLS message? cl_echo 7704 "Driver $DRIVER is not available." "$DRIVER" exit 1 fi fi #if the port with such a name has already been defined, clean up rmdev -l $PORT -d # create the port mksx25 -c port -s star \ -l $PORT "$ADD_ON_PORT" -a local_nua=$NUA \ -a network_id=${NETID:-5} ${CCODE:+ -a country_prefix=\'$CCODE\'} if [ $? -ne 0 ]; then # does this one need an NLS message? cl_echo 7705 "Failed creating $PORT on $DRIVER." "$PORT" "$DRIVER" exit 1 fi # set up the COMIO driver, if required if expr "$TYPE" : '.*sna.*' > /dev/null then mkdev -c port -s stx25c -t ciox25 -w 0 -p "$PORT" if [ $? -ne 0 ] then # does this one need an NLS message? cl_echo 7706 "Failed starting COMIO service for $PORT" "$PORT" exit 1 fi fi exit 0