Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

rmdev on a busy device

Troubleshooting

rmdev on a busy device

by  MoshiachNow  Posted    (Edited  )
#!/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
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top