I have jotted the following script to do that.
Check it out in test environment.
#!/usr/bin/ksh
EXCLUDELISTSDIR=/usr/openv/netbackup/db/excludelists/
CATALOG=/usr/openv/netbackup/db/client/
BPCLIENTCHECK=/space/bpclientcheck.ksh
PROGNAME=`basename $0`
TEMPFILE=/tmp/$PROGNAME.$
Status=0
#
#This script renames Netbackup client from a command line
#
#Note 1. We store exclude list for each Windows-based host in /usr/openv/netbackup/db/excludelists/<hostname>
# It is some kind of global database of exclude lists.
#Note 2. bpclientcheck.ksh is a simple script that checks its first argument against 'bpplclient' output
#
#
#Check command line args
#
#
#Note 1. We store exclude list for each Windows-based host in /usr/openv/netbackup/db/excludelists/<hostname>
# text file. It is some kind of simple global database of exclude lists.
#Note 2. bpclientcheck.ksh is a one-line script that checks its first argument against 'bpplclient' output
#
if (( $# < 2 ))
then
print "Usage: $PROGNAME host newname"
exit 1
fi
host=$1
newname=$2
TEMPFILE=/tmp/$PROGNAME.$host.$newname
echo "CLIENT_NAME = $newname" > $TEMPFILE 2> /dev/null
#
#Check if client $host is in NetBackup environment
#
if ! $BPCLIENTCHECK $host > /dev/null 2>&1
then
print "$PROGNAME: $host is not in NetBackup environment"
exit 1
fi
#
#Rename host file in exclude list database
#
if [[ -f $EXCLUDELISTSDIR$host ]]
then
if mv $EXCLUDELISTSDIR$host $EXCLUDELISTSDIR$newname > /dev/null 2>&1
then
print "$PROGNAME: $EXCLUDELISTSDIR$host has been sucessfully renamed to $EXCLUDELISTSDIR$newname"
else
print "$PROGNAME: Can't rename $EXCLUDELISTSDIR$host to $EXCLUDELISTSDIR$newname!"
exit 1
fi
fi
#
#Change client name in all NetBackup policies where this client exists
#
for cl in `$BPCLIENTCHECK $host`
do
if bpplclients $cl -rename $host $newname > /dev/null 2>&1
then
print "$PROGNAME: $host has been sucessfully renamed to $newname in policy $cl"
else
print "$PROGNAME: Can't rename $host to $newname in policy $cl!"
exit 1
fi
done
#
#Rename client directory in NetBackup Catalog
#
#if mv $CATALOG$hostname $CATALOG$newname > /dev/null 2>&1
#then
# print "$PROGNAME: $host has been sucessfully renamed to $newname in policy NetBackup Catalog"
#else
# print "$PROGNAME: Can't rename $host to $newname in policy $cl!"
# exit 1
#fi
#
#Change client name in client's bp.conf
#
if [[ -f $TEMPFILE ]]
then
if bpsetconfig -h $host "$TEMPFILE" > /dev/null 2>&1
then
print "$PROGNAME: $host has been sucessfully renamed to $newname in client's bp.conf"
else
print "$PROGNAME: Can't rename $host to $newname!"
exit 1
fi
else
print "Can't open file $TEMPFILE!"
fi