03-10-2016 08:50 AM
Hello,
after performing:
bpimagelist -rl 5 -d 12/31/2015 01:00:00 -e 04/09/2016 23:59:59 -U
I like to have a script that would allow me to reduce the retention level 5 to level 4 of all images on copy 1 and copy 2.
thank you in advance for your help
Solved! Go to Solution.
03-10-2016 02:49 PM
Hello Steven05,
please try this
]# for i in $(/usr/openv/netbackup/bin/admincmd/bpimagelist -idonly -d 01/01/2016 -e 10/02/2016 -rl 5 |grep -i ID |sed 's/.....................................//' |sed 's/ FULL (0)//g'); do echo $i |tee -a /tmp/retention.txt ;/usr/openv/netbackup/bin/admincmd/bpexpdate -recalculate -backupid $i -copy 1 -ret 4 ; done
sed : is to get only the backup ID to continue with the command execution, you can use the first part just to get the ID only, and use for other type of commands in NBU.
The dates 01/01/2016 -e 10/02/2016 = just in case you want target the images on a time frame.
You need to acknoledge the change for each image, === type Y and enter, you can do this with 2 fingers, Unfortenately I did not manage yet, to put this into the command straight away, but it will be fast in all cases, and less intervention.
I am putting this into the forum, because I belive that just the fact to get the backup id from the first command line can really be helpful for lot of people.
Best regards,
Cruisen
03-10-2016 09:47 AM
bpimagelist -rl 5 -d 12/31/2015 01:00:00 -e 04/09/2016 23:59:59 -l | grep IMAGE | awk '{print $6}' | while read image
do
bpexpdate -recalculate -backupid $image -copy 1 -ret 4
bpexpdate -recalculate -backupid $image -copy 2 -ret 4
done
Or you can use to show you the actual command string
bpimagelist -rl 5 -d 12/31/2015 01:00:00 -e 04/09/2016 23:59:59 -l | grep IMAGE | awk '{print "bpexpdate -recalculate -backupid "$6" -copy 1 -ret 4"}'
then add "|sh" to execute it
bpimagelist -rl 5 -d 12/31/2015 01:00:00 -e 04/09/2016 23:59:59 -l | grep IMAGE | awk '{print "bpexpdate -recalculate -backupid "$6" -copy 1 -ret 4"}'|sh
You'll need to run it once more for the other copy, or you can remove the copy and it will apply to the whole image.
03-10-2016 02:49 PM
Hello Steven05,
please try this
]# for i in $(/usr/openv/netbackup/bin/admincmd/bpimagelist -idonly -d 01/01/2016 -e 10/02/2016 -rl 5 |grep -i ID |sed 's/.....................................//' |sed 's/ FULL (0)//g'); do echo $i |tee -a /tmp/retention.txt ;/usr/openv/netbackup/bin/admincmd/bpexpdate -recalculate -backupid $i -copy 1 -ret 4 ; done
sed : is to get only the backup ID to continue with the command execution, you can use the first part just to get the ID only, and use for other type of commands in NBU.
The dates 01/01/2016 -e 10/02/2016 = just in case you want target the images on a time frame.
You need to acknoledge the change for each image, === type Y and enter, you can do this with 2 fingers, Unfortenately I did not manage yet, to put this into the command straight away, but it will be fast in all cases, and less intervention.
I am putting this into the forum, because I belive that just the fact to get the backup id from the first command line can really be helpful for lot of people.
Best regards,
Cruisen
03-11-2016 07:01 AM
Hello
Thank you for your answers Mister Riaan.Badenhorst and Mister cruisen
You helped me solve my problem.
Best regards,
Steven05