#!/bin/ksh
###########################################################################################
# Updated Jan 21, 2004
# Version 1.1
# A simple script that removes any entX interface,after stopping all network protocols and removing the relevant enX
###########################################################################################
#Get the required entX name from the input
if [[ $1 != ent? ]] ;then
echo ôUsage: rment.sh <entX> ô
exit 1
fi
ENT=$1 #This is required ent
EN=`echo $1 |cut ûc 4` #This is required en number
#Check that entX exists, exit if not
lsdev ûCs pci |grep ent|awk '{ print $1 }'|grep $1
if [[ $? != 0 ]] ;then
echo ô$1 does not exist !ö
exit 1
fi
while true
do
echo ôIf the $ENT is your default interface - PLEASE DO NOT RUN THIS SCRIPT FROM TELNET !\nTHIS OPERATION WILL CUTT OFF ANY IP CONNECTIONS !\nö
echo "Do you really want to remove the $ENT (the script will exit if you choose No) (y/n) [Y]:\c"
read answer
if [[ $answer = [Yy] ]] || [[ -z $answer ]] ;then
echo ôremoving the en$EN and et$EN . . .ö
chdev -l en$EN -a state='down'
chdev -l et$EN -a state='down'
rmdev -dl en$EN
rmdev -dl et$EN
echo ôremoving the $1 . . .ö
rmdev -dl $1
if [[ $? = 0 ]] ;then
echo ô$ENT was successfully removed.\nTo recover - run cfgmgr ,define TCPIP ,FULL/HALF DUPLEX .\nIf the $ENT is your default interface û reboot the systemö
exit 0
else
echo ô$ENT removal has failed !ö
exit 1
fi
elif [[ $answer = [Nn] ]] ;then
exit
else
echo "\n Please answer y/n only !\n"
fi
done
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.