Add new media server to all or select clients without overwriting server list
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