Showing results for 
Search instead for 
Did you mean: 

Add new media server to all or select clients without overwriting server list

Level 2

I have seen several discussions about the add_media_server_on_clients script, and the now deprecated add_media_server script, and none had an answer that suited my needs. 

I wanted to simply append the server list on my clients with a new media server (actually a geographically select group of servers).  Not overwrite the list with the master server list, or open each client up one by one in the gui, or with bpsetconfig and a master list.  Simply append the new media server to the server list, just like the old add_media_server script did.

Anyway, I have a quick and dirty way to do it.  Your mileage may vary but thought I'd share in case someone else is having a similar issue.

Do not judge me by this script, I know how to do it right, for sake of brevity I'm doing the bare minimum of commands here.

**Please note, there are NO safetys here, if you are not 100% sure of what is happening below do not use**

Also the script does not clean up after itself.

#Create temp directory
mkdir /tmp/setserver/

#List and sort all client
for i in `/usr/openv/netbackup/bin/admincmd/bppllist -allpolicies | grep CLIENT | awk ' { print $2 } ' | sort -u` > /tmp/setserver/sortedclientlist

#Dump the current config of the client to a temp file
do /usr/openv/netbackup/bin/admincmd/bpgetconfig -M $i | grep "^SERVER =" > /tmp/setserver/$i

#Add new server to temp config file
echo "SERVER = newmediaservernamehere" >> /tmp/setserver/$i

#Add second server (if needed) to config file
echo "SERVER = 2ndnewmediaserverhere" >> /tmp/setserver/$i

#Run bpsetconfig command using the file generated from bpgetconfig and appended using the script
/usr/openv/netbackup/bin/admincmd/bpsetconfig -h $i /tmp/setserver/$i


If you want it all on one line

for i in `/usr/openv/netbackup/bin/admincmd/bppllist -allpolicies | grep CLIENT | awk ' { print $2 } ' | sort -u` > /tmp/setserver/sortedclientlist;do /usr/openv/netbackup/bin/admincmd/bpgetconfig -M $i | grep "^SERVER =" > /tmp/setserver/$i;echo "SERVER = newmediaservernamehere" >> /tmp/setserver/$i;echo "SERVER = 2ndnewmediaserverhere" >> /tmp/setserver/$i;/usr/openv/netbackup/bin/admincmd/bpsetconfig -h $i /tmp/setserver/$i;done



Level 2

Thank you for this tip!! I have been trying to do this for ages since upgrading to 7.x.

Level 6
Partner Accredited Certified

Good Scripting

Level 6

Very good. One thing, you can do without the grep as you have awk grabbing the 2nd field


grep CLIENT | awk ' { print $2 } 

can be shortened to

awk '/CLIENT/{print $2}'


Just makes the script run that tiny bit quicker.


Level 2

Cool, thanks for the tip.  There is a lot of room for improvment over all I expect, I just haven't spent the time to do it.

One thing of note, you can easily dump your client list to a file, and parse out a subsection to another file and use that as the source.  For example, we have policies that include geographic location as part of the naming convention, so I dump a list of clients that are all in data center X to add the media server to.

I'm sure everything could be read into variables instead of dumping to flat files, and some error checking, and some backgrounding to allow it to run in parallel.  If I get some time I might write a more elegent version of it.

The add_media_server_on_clients in 7.5 is a binary not a script.  Anyone have a copy of the old add_media_server from 6?  The binary/script that allowed you to append a new media server to a client?  I was just curious if it too was a binary, or if it might be a script?