Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

script

Status
Not open for further replies.

day88

Technical User
Jul 14, 2001
81
SG
Hi guys,

I need to unmount the tapes which used for the last backup and send it to the library CAP in order to send to offsite.

I know i can use mmimfo to query the tapes used and nsrjb to umount and withdrawn the tapes but how am i going to write a completely automated scripts with these two command?

Thanks guys

 
what's your platform & scripting language? I'm assuming unix/ksh

If I was you I'd do something like this. This command syntax isn't correct, obviously - this is just a rough idea of how it might work:

for each {tape} in `{output of an nsrjb inventory}`
do
dateval=`{output of mminfo ${tape}|awk {date field}}`
if {$dateval is appropriate date}
then
unmount and withdraw $tape
done


that'll probably be hideously inefficient if you've got a lot of tapes in the box, but in theory it should work. The mminfo output will probably contain multiple lines so you may need to sort -u on the date value and check each unique date against your appropriate date.

--Mary Dell

 
that the problem!!! it a Windows 2000 server
 
Use a .bat file.
mminfo the volume names into a file
use the batch scripting to read the file and go through it to unload/withdraw each volume.
 
Hi,

Can give me the details of the "batch scripting" you mentioned???

I managed to get all the volume name into a file already

thanks
 
for /F %%variable in (set) do command [command-parameters]

where set is the file and command parameters are what you are doing (your nsrjb command).
 
I currently use the following within a batchfile for my test environment. This is very rough as I am testing:

Del .\networkercloneFULL.txt

mminfo -s backup-server1 -q"group=London Full1, savetime>=%1 days ago, savetime<=%2 days ago" -r"ssid" > networkercloneFULL.txt
sleep 5
mminfo -s backup-server1 -q"group=London Full2, savetime>=%1 days ago, savetime<=%2 days ago" -r"ssid" >> networkercloneFull.txt
sleep 5
mminfo -s backup-server1 -q"group=Derby Full1, savetime>=%1 days ago, savetime<=%2 days ago" -r"ssid" >> networkercloneFULL.txt
sleep 5
mminfo -s backup-server1 -q"group=Derby Full2, savetime>=%1 days ago, savetime<=%2 days ago" -r"ssid" >> networkercloneFULL.txt
sleep 5
nsrclone -s backup-server1 -b "Clone Full" -S -f networkercloneFULL.txt
sleep 20
nsrjb -u -f \\.\Tape0


I downloaded sleep from the w2k resource kit.......it was needed especially before the nsrjb command. I currently input days from the command line.....more useful for testing.

I am considering converting these commands to wsh/vbs as I prune the indexes with vb script already.

Si
 
Hi guys,

There are around 15 tapes used in my daily backup,
i used mminfo with the "savetime" option and output it to a file (example output_tape.out)

Then,
for /F %%i in (output_tape.out) do nsrjb -w %i

It ejected all the tapes from the slots to my Catridge Access Port, but my CAP have only 10 slots, after ejecting the number 10 tape, the rest will failed.

How to use the for /F command and only eject number 1 to number 10 tape ???

I tried using the option "tokens=1-10" but it still ejected all 15 tapes.

Thanks :)




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top