cancel
Showing results for 
Search instead for 
Did you mean: 

Deactivating a client

FrSchind
Level 5
Partner
Hi,

sometimes it's necessary to deactivate a client for some time. NetBackup doesn't make this easy for us admins, since there is no such option in the GUI. The most common way is to delete the client from the policies and put it back in later.

The definition of clients per policy can be found in the file system of your NetBackup master in /usr/openv/netbackup/db/class/ - so this is a possibility to fiddle around when deactivating a client. Editing the files directly with an editor is not a good idea - as you will notice there are checksums at the end of each file. The client name can be changed with the command "bpplclients <policy> -rename <oldname> <newname>". When you change the name of the client from "<client>" to "#<client" the client is commented out in the configuration file and no backups will be scheduled. The bad thing is, you will not see this client in the GUI. 

To make all this a little easier i wrote three little scripts.

To switch a client off in all policies use the first one. Partial client names can be uses, all matching clients will be disabled:

#!/bin/bash
if [[ $# -ne 1 ]]
then
        echo " Usage: $0 <client_in_question>"
        exit 1
fi

for i in `ls /opt/openv/netbackup/db/class`
do cat /opt/openv/netbackup/db/class/$i/clients  2> /dev/null | grep -v VMD5_DIGEST | grep -i $1  &> /dev/null
 if [ "${?}" != 1 ] ; then
 for j in `cat /opt/openv/netbackup/db/class/$i/clients |awk  '{print $1}'| grep -i $1`
  do

`cat /opt/openv/netbackup/db/class/$i/clients | grep -i $j | grep -v VMD5_DIGEST | grep -v '^#' | awk '{print "bpplclients '''$i''' -rename " $1 " #"$1}'`

  done
fi
done
Now you're able to disable clients. Enabling them is a little more difficult, because NetBackup "thinks" this client does not exist in the policy and cannot be renamed. So I remove the # from the configuration file and then rename the client again to get the checksum right:
#!/bin/bash
if [[ $# -ne 1 ]]
then
        echo " Usage: $0 <client_in_question>"
        exit 1
fi

for i in `ls /opt/openv/netbackup/db/class`
do cat /opt/openv/netbackup/db/class/$i/clients  2> /dev/null | grep -v VMD5_DIGEST | grep '^\#' |  grep -i $1  &> /dev/null

 if [ "${?}" != 1 ] ; then
 for j in `cat /opt/openv/netbackup/db/class/$i/clients |awk  '{print $1}'| grep -i $1`
  do
client=`echo ${j} | sed 's/\#//'`
cp /opt/openv/netbackup/db/class/$i/clients  /opt/openv/netbackup/db/class/$i/clients.bak
sed -e "s/\#${client}/aus_${client}/" < /opt/openv/netbackup/db/class/$i/clients.bak > /opt/openv/netbackup/db/class/$i/clients

bpplclients $i -rename aus_${client} ${client}
  done
 fi
done
OK, the last script is for finding out which policies a client is in. Called with the parameter '#' (include the single quotes!) you will get all the disabled clients. This works just as well by using bppllist -byclient, but way faster:
#!/bin/bash

if [[ $# -ne 1 ]] then         echo " Usage: $0 <client_in_question>"         exit 1 fi printf "\nClient\t\tTyp\tOS\t\tPolicy\n-----------------------------\n" for i in `ls /opt/openv/netbackup/db/class` do cat /opt/openv/netbackup/db/class/$i/clients 2> /dev/null | grep -v VMD5_DIGEST | grep -i $1 &> /dev/null  if [ "${?}" = 0 ] ; then  for j in `cat /opt/openv/netbackup/db/class/$i/clients |awk '{print $1}'| grep -i $1`   do printf "`cat /opt/openv/netbackup/db/class/$i/clients | grep -v VMD5_DIGEST | grep -i $j | awk '{print $1" "$2" "$3" '''$i'''"}'`\n" echo ----------------------------- done fi done