cancel
Showing results for 
Search instead for 
Did you mean: 

Rename a NetBackup client from a command line

Anton_Panyushki
Level 6
Certified
Hello,
 
 
Is there any command or script to rename a NetBackup client from a command line? The problem is that client renaming is the multistep process so I find it difficult to do a bulk renaming.
7 REPLIES 7

Stumpr2
Level 6


Anton Panyushkin wrote:
The problem is that client renaming is the multistep process

Let's start by identifying the mutiple steps needed...
 

 

Rakesh_Khandelw
Level 6
Look into man pages for bpclient and bpplclients. You should be able to use bpplclients to rename the client name but you need to provide policy name with it.

Omar_Villa
Level 6
Employee
I will recomend to add the new names and then delete the old ones, be sure your DNS is updated to

Stumpr2
Level 6
Anton,
See what I mean by numbering all the steps first?
heres another step.
 
move the catalog files for the old clientname to the new clientname
 
 

calculus
Level 4
       
1. use
      bpplclients policy_name [-M master_server...] [-v]             {-rename old_host_name new_host_name    [-hardware hardware]
           [-os os]  [-priority priority]}
   
      Valid values for policy_type:
          Standard  Apollo-wbak  Oracle  NetWare  DataTools-SQL-BackTrack
          MS-Windows-NT  OS/2  MS-SQL-Server  SAP
          AFS  Lotus-Notes  Vault

          
          
2. move the files from the old client directory under catalogue to the new client directory " as Bob said ", d
3. fire a backup
4. Try a restore from the old date, with the new client name.










Stumpr2
Level 6
another step is to change the CLIENT_NAME entry in the bp.conf/registry

Anton_Panyushki
Level 6
Certified
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