Guys,
I have a script that should change one of the configuration Parameter in a http accelerator, this config change which will halt http traffic into device. So I have designed a script which should do these changes. But after executing this script, found that one of the input variable is not getting assigned & the changes are not being implementated into the accelerator device & http traffic is not being halted. So anybody do you have resolution to this issue, for which im going to have my script placed here to help you guys.
# sample Script to Outrotate the Device in Question
# Script Creation Date 01/21/2010
# Author baraghun
##*******************************************************************************************************
## ********** FUNCTION USAGE ***********
##*******************************************************************************************************
##
# Script name without path
BASENAME=`basename $0`
#The INFILE is going to use during the SSH
INFILE=${HOME}/config/inFile.txt
#The changes will write to OUTFILE
OUTFILE=/tmp/outFile.txt
# Functional Usage
usage() {
echo
echo "USAGE"
echo " "`basename $0`" <device> <disable|enable> "
echo
exit
}
outrotate() {
echo
echo "OUTROTATE"
echo "**********************************************************************"
echo " Removing your Device `${htACC}` in Question . . . "
echo "**********************************************************************"
echo
}
trafficrouting() {
#Local Variables
#
local STATE="$1"
#
cat << EOF > $INFILE
po1023
pssphrase
config
switch accMode RouteTrafficACC THIS SECTION is a FIRMWARE COM's
admin ${STATE}
bye
bye
write memory
y
bye
goodbye
EOF
}
#
#Validate the device name
#
echo $1 | egrep "^(CMOX|PXOM|TXOM)[0-9][0-9][0-9][0-9]\-ra$" > /dev/null 2>&1
if [ $? -ne 0 ]
then
echo
echo "Node doesn't exist"
else
echo "You are lucky enough"
fi
htACC="$1"
# Check the parameters
#
[ $# -ne 2 ] && usage
# Check the input parameters
#
case $2 in
disable)
RouteTrafficACC disable
;;
enable)
RouteTrafficACC enable
;;
*)
usage
;;
esac
#
# Apply the changes
#
ssh -T ${htACC} < $INFILE >> $OUTFILE
#
# Remove unused files
#
chmod 777 ${OUTFILE}
Now the issue description is here
-
Function one (usage) is being executed only with first variable (device) for which we do get a response back. But the second variable <disable|enable> is not being recognized.
-
Since issue is with the Function one's 2 variable, function two (outrotate) is not being executed along with the function three's {STATE} & save command is not functioning to disable the device.
Here is the output of the script
$ ./outrotate.sh CMOX1234-ra disable
You are lucky enough
USAGE
DPoutrotate.sh <device> <disable|enable>
The Log from outFile
Serial number: 1X23K00C0
ACC># Global configuration mode
ACC>(config)# ACC>[accMode](config)# Modify Multi-Protocol Gateway configuration
ACC>[accMode](config RouteTrafficACC)# Usage: admin <enabled|disabled>
ACC>[accMode](config RouteTrafficACC)# ACC>[accMode](config)# ACC>[accMode]# Unknown command or macro (write memory)
ACC>[accMode]# Unknown command or macro (bye)
ACC>[accMode]# Goodbye
So from the above logs you can figure out where the issue existing. its none other than the admin STATE.