286
1.877.877.2269
BLACKBOX.COM
NEED HELP?
LEAVE THE TECH TO US
LIVE 24/7
TECHNICAL
SUPPORT
1.877.877.2269
CHAPTER 16: ADVANCED CONFIGURATION
These two lines assign a new email address to TOADDR and invoke the alert-email script in the background.
16.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 (for example config.users.user1 or config.sdt.hosts.host1).
delete-node is a general script for deleting any node you desire (users, groups, hosts, UPS’s, etc.) from the command line. The
script deletes the specified node and shuffles the remainder of the node values.
For example, if we have five users configured and we use the script to delete user 3, then user 4 will become user 3, and user 5 will
become user 4.
This creates an obvious complication as this script does not check for any other dependencies that the node being deleted may
have had. So you are responsible for making sure that 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}
so to remove, for example, user 3:
# ./delete-node config.users.user3
The delete-note script
# !/bin/bash
# User must provide the node to be removed. eg "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
fi
# 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
fi
# testing if node exists
TEMP=`config -g config | grep "$1"`
if [ -z "$TEMP" ]
then
echo "Node $1 not found"