Tripp Lite B093-004-2E4U-V 4-Port Console Server with 4G LTE Cellular Gateway, Dual GbE NIC, 4Gb Flash and Dual SIM

Owner's Manual - Page 234

For B093-004-2E4U-V. Also, The document are for others Tripp Lite models: B093-00X-2E4U-X, B097-016/048, B098-016/048, B098-016-V

PDF File Manual, 285 pages, Read Online | Download pdf file

B093-004-2E4U-V photo
Loading ...
Loading ...
Loading ...
234
15. Advanced Configuration
15.1.5 Deleting Configuration Values from the CLI
The delete-node script is provided to help with deleting nodes from the command line. The “delete-node” script takes one
argument: the node name you want to delete (e.g., “config.users.user1” or “config.sdt.hosts.host1”).
Delete-node is a general script for deleting any node you desire (users, groups, hosts, UPS systems, etc.) from the command
line. The script deletes the specified node and shuffles the remainder of the node values.
For example, if there are five users configured and we use the script to delete user 3, then user 4 will become user 3, user 5
will become user 4, and so on.
This creates a complication, as this script does NOT check for any other dependencies that the node being deleted may have
had. You are responsible for making sure any references and dependencies connected to the deleted node are removed or
corrected in the config.xml file.
The script treats all nodes the same. The syntax to run the script is # ./delete-node {node name} . To remove user 3:
# ./delete-node config.users.user3
The delete-node script
#!/bin/bash
#User must provide the node to be removed. e.g. “config.users.user1”
# Usage: delete-node {full node path}
if [ $# != 1 ]
then
echo “Wrong number of arguments”
echo “Usage: delnode {full ‘.’ delimited node path}”
exit 2
# test for spaces
TEMP=`echo “$1” | sed ‘s/.* .*/N/’`
if [ “$TEMP” = “N” ]
then
echo “Wrong input format”
echo “Usage: delnode {full ‘.’ delimited node path}”
exit 2
# testing if node exists
TEMP=`config -g config | grep “$1”`
if [ -z “$TEMP” ]
then
echo “Node $1 not found”
exit 0
# 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 ]
Loading ...
Loading ...
Loading ...