#!/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 doneNow 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 doneOK, 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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.