Console Server & Router User Manual
269
echo "Wrong input format"
echo "Usage: delnode {full '.' delimited node path}"
exit 2
fi
# testing if node exists
TEMP=`config -g config | grep "$1"`
if [ -z "$TEMP" ]
then
echo "Node $1 not found"
exit 0
fi
# LASTFIELD is the last field in the node path e.g. "user1"
# ROOTNODE is the upper level of the node e.g. "config.users"
# NUMBER is the integer value extracted from LASTFIELD e.g. "1"
# TOTALNODE is the node name for the total e.g. "config.users.total"
# TOTAL is the value of the total number of items before deleting e.g. "3"
# NEWTOTAL is the modified total i.e. TOTAL-1
# CHECKTOTAL checks if TOTAL is the actual total items in .xml
LASTFIELD=${1##*.}
ROOTNODE=${1%.*}
NUMBER=`echo $LASTFIELD | sed 's/^[a-zA-Z]*//g'`
TOTALNODE=`echo ${1%.*} | sed 's/\(.*\)/\1.total/'`
TOTAL=`config -g $TOTALNODE | sed 's/.* //'`
NEWTOTAL=$[ $TOTAL -1 ]
# Make backup copy of config file
cp /etc/config/config.xml /etc/config/config.bak
echo "backup of /etc/config/config.xml saved in /etc/config/config.bak"
if [ -z $NUMBER ] # test whether a singular node is being \
#deleted e.g. config.sdt.hosts
then
echo "deleting $1"
config -d "$1"
echo Done
exit 0
elif [ $NUMBER = $TOTAL ] # Test if only one item exists
then
echo "only one item exists"
# Deleting node
echo "Deleting $1"
config -d "$1"
# Modifying item total.
config -s "$TOTALNODE=0"
echo Done
exit 0
Summary of Contents for ACM5000
Page 3: ......
Page 10: ...Table of Contents 10 Console Server RIM Gateway User Manual...
Page 11: ......
Page 94: ...Chapter 5 Firewall Failover and Out of Band 94 Console Server RIM Gateway User Manual...
Page 119: ......
Page 149: ......
Page 191: ......
Page 205: ......
Page 225: ......
Page 303: ......
Page 313: ......
Page 323: ......