#!/bin/ksh # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # 61haes_r714 src/43haes/usr/sbin/cluster/events/utils/cl_stop_x25_link.sh 1.4 # # Licensed Materials - Property of IBM # # COPYRIGHT International Business Machines Corp. 2002 # 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 # @(#)85 1.4 src/43haes/usr/sbin/cluster/events/utils/cl_stop_x25_link.sh, hacmp.hawan, 61haes_r714 2/22/02 12:53:36 ## ## Script: cl_stop_x25_link ## ## Syntax: ## cl_stop_x25_link ## ## Called-by: clcommlinkd ## ## Parameters: port = the AIX system name for the SX25 port ## examples: sx25a0, sx25a1, etc. ## ## 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.4' PORT=$1 # are all required parameters present? if [[ -z "$PORT" ]] then echo "$PROGNAME: usage" echo " cl_stop_x25_link " exit 2 fi # check to see if the link is actually defined LINK_STATE=`LC_ALL=C x25status 2> /dev/null | awk " BEGIN { cur_state = \"BEGIN\" } { if(cur_state == \"BEGIN\" && \\\$1 == \"PORT\" && \\\$2 == \"PACKET\" && \\\$3 == \"STATE\" ) cur_state = \"PRINT\" else if(cur_state == \"PRINT\") if(NF > 0) { if(\\\$1 ~ /$PORT/) print \\\$2 } else cur_state = \"DONE\" }"` if [[ -z "${LINK_STATE}" ]] then # the link isn't even defined, so nothing to stop exit 0 fi # stop COMIO if it's running COMIO=`lsx25 | awk "\\\$3 == \"$PORT\" { print \\\$4 }"` if [[ "$COMIO" = x25s* ]] then rmdev -l $COMIO -d if [ $? -ne 0 ] then cl_echo 7707 "Failure removing COMIO port $COMIO." "$COMIO" exit 1 fi fi # finally, remove the x25 port rmsx25 -l "$PORT" -d if [ $? -ne 0 ] then cl_echo 7708 "Failure removing port $PORT." "$PORT" exit 1 fi exit 0