02-21-2012 09:27 PM
what is the command to find the tapes in library which will expire tomorrow?
Solved! Go to Solution.
03-12-2012 11:57 AM
Yes, that is probably better .. give it a go, if it works then great.
The script could probably be a bit better, it was just a quick way to demonstrate that to do things in netbackup, sometimes you have to use multiple commands, as in this case.
Martin
02-21-2012 10:03 PM
Tape Summary Report from Admin Console
or
bpmedialist -summary -U
02-23-2012 11:21 PM
it gives me all the media list.
I want only those tapes that will expire tmrw?
02-24-2012 12:44 AM
It cannot be done in a single NetBackup command.
The bpmedialist command gives the information, you then have to sort it manually.
For example, I used the very command given by Mick, and then used the operating system (Unix) grep command to filter the results :
02-25-2012 01:58 AM
thanks
02-25-2012 08:43 AM
#!/bin/bash
bpmedialist -summary | \
awk \
' \
$2=="expires" && $1~/^W[LR][0-9]*/ \
{print $1,$2,substr($3,7,4) substr($3,1,2) substr($3,4,2)} \
' | \
sort -k 3.1 | \
head
02-26-2012 03:19 AM
ho to execute this script?
can u tell the complete steps?
02-26-2012 12:21 PM
...just like you'd do with any script. In Unix, you just copy the content of the script I gave you in a new file and make it executable:
bash# touch script.sh
bash# vi script.sh (paste the script and save it using either Shift+ZZ or :wq )
bash# chmod 770 script.sh (change permissions on the new script)
bash# ./script.sh
02-26-2012 12:41 PM
The script will only work on unix / linux, not windows.
02-28-2012 08:09 AM
hi chronos,
At what path to execute this script?
02-28-2012 08:27 AM
typically /usr/openv/netbackup/bin/admincmd/ and /usr/openv/netbackup/bin/
03-10-2012 12:40 AM
@Martin :i wana know which tapes are in library which will expire tomorrow ?
tapes in library not offsited.
The command which u told gives list of tapes offsited.
@chronos:when i am running the script ,i am getting the error,
permission denied:bpmedialist not found.
03-10-2012 02:16 AM
You need to be in the directory where the command is located.
/usr/openv/netbackup/bin/admincmd/bpmedialist
Or, (better) - add the paths:
/usr/openv/netbackup/bin
/usr/openv/netbackup/bin/admincmd
/usr/openv/volmgr/bin
to the Unix PATH environment variable so that you can run the NetBackup commnads without having to 'cd' to the directories all the time.
Martin
03-10-2012 04:52 AM
03-10-2012 06:20 AM
Martin has suggested the command on 24 February to find tapes expiring on 25 February.
If you execute the command as is on 10 March, it will not find anything.
03-10-2012 06:27 AM
Yes, Marianne makes a good point, you have to change the date as required.
The 'actual command' is correct ...
Martin
03-10-2012 06:41 AM
BUT I WANT THOSE TAPES WHICH ARE IN THE LIBRARY.
THIS COMMAND GIVES ME THE TAPES WHICH WILL EXPIRE TOMORROW BOTH WHICH ARE OFFSITE AND ONSITE.
I want only those tapes which will expire and is onsite.
03-10-2012 10:47 AM
Not sure you can do it from this command, not to get exactly what you want.
You would have to get the tapes that expire 'tomorrow' with the commands we have given, then check these tapes against vmquery -m <media ID>
Eg.
03-11-2012 05:21 AM
i will run it and let u know.
03-12-2012 09:20 AM
though I would change
if [[ $(vmquery -m $TAPE |grep robot |awk '{print $3}') != NONE ]]
to