You are on page 1of 3

Scripts

------------------------------------------------------------------------------------------------------------
bppllist >/tmp/PaRaS
for i in `cat /tmp/PaRaS`
do
k=`bppllist $i -L | grep Active | awk '{ print $2 }'`
if [ "$k" == "yes" ]
then
echo "$i policy is Active " >>/tmp/PaRaS1
else
echo " $i policy is Deactive" >>/tmp/PaRaS2
fi
done
M=`cat /tmp/PaRaS1 | wc -l`
echo "below shows the $M active policies"
sleep 10
cat /tmp/PaRaS1
N=`cat /tmp/PaRaS2 | wc -l`
echo "below shows the $N deactive policies"
sleep 10
cat /tmp/PaRaS2
rm /tmp/PaRaS /tmp/PaRaS1 /tmp/PaRaS2
------------------------------------------------------------------------------------------------------------
cscmanaus003(root):# vi test
"test" 2 lines, 44 characters
bpplclients |awk '{print $3}' >/tmp/test1
sed '1,2d' /tmp/test1 >/tmp/test2
(sed : remove the header info like Client & -------)

Ex: Client
--------------
audtnt02
ausvmacnba07
------------------------------------------------------------------------------------------------------------
Script : for loop
cscmanaus003(root):# more test1
for i in `cat /tmp/test`
do
vmchange -p 4 -m $i
done
------------------------------------------------------------------------------------------------------------

more /tmp/NB5.1/clients_ver1 |egrep -i 'Client Name |Version Name'


for more info grep
------------------------------------------------------------------------------------------------------------
To get a listing of all clients and the IP netbackup resolves them to use this snippet.
for host in $( bpclclients -allunique -noheader | awk '{print $3}' )
{
echo -ne "$host "
bpclntcmd -hn $host | head -1 | awk '{print $5}'
}
------------------------------------------------------------------------------------------------------------
Awk --- UNIX filter command for manipulated the contents of a file.
cat abc.txt | awk '{print $7 " " $5 " " $3}'
Ex: vmquery -p 1 -l |awk '{print $1}' |more > test
------------------------------------------------------------------------------------------------------------
find /usr/openv/netbackup/db/images -ls >/tmp/f1
more f1 | awk ' $3 !~ /d/ {print $0}' >/tmp/f2
more f2 | egrep -v "catstore|lck" >/tmp/f3
cat f3 | awk ' $7 == 0 {print $11}' >/tmp/finalop

for i in `cat /usr/openv/volmgr/vm.conf |grep DEVICE_HOST |awk '{print $3}'`; do bperror


-hoursago 168 -server $i |grep Kbytes/sec |grep -v

duplicate|grep -v restore|awk -F\, '{print $NF}' |awk '{l = l + $3} {j = j + $5}{k = k + 1} END
{print "'"$i"'",l,j/k}'; done

here is how the sample output will look like

motmas1 0 0
motmed1 13632577307 69697.2
motmed2 28468392731 34072.1
motmed3 19698648604 17457.4
motmed4 17427685858 22172.3
motmed5 15946925497 12048.7
motmed6 19037189022 14719.8
motmed7 17675250160 53308.5

It gives the media server name , Total amount of data backed up(in KB). Average speed of the
backup(in KB).
------------------------------------------------------------------------------------------------------------
/usr/openv/netbackup/bin/admincmd/bperror -U -backstat -s info -d 06/27/07 –client
cscpapcbly401 |grep -v "(timed out connecting to client)" (it gives the out put
without printing the line “timed out….”)

To get NetBackup clients version


for i in `bpclclients -allunique -noheader|awk '{print $3}'`
do
echo "$i\c"
bpgetconfig -g $i -l | awk '{FS=";"} {print $2, $5}'
done
------------------------------------------------------------------------------------------------------------

You might also like