Veritas-bu

[Veritas-bu] Catalog Script Needed

2004-02-12 10:36:32
Subject: [Veritas-bu] Catalog Script Needed
From: Keath.Marx AT anthem DOT com (Marx, Keath)
Date: Thu, 12 Feb 2004 10:36:32 -0500
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C3F17D.FD77640F
Content-Type: text/plain

I have one that is written in AutoIT.  AutoIT is a free scripting language.
The website is http://www.hiddensoft.com <http://www.hiddensoft.com> 

They are in final beta of AutoIT V3 but it is a radical rewrite of the
language.  I haven't looked at learning it yet.  The nice thing about autoIT
is that you don't have to install it on the server.  It can compile the
scripts into an executable which can be run anywhere.  

My script doesn't currently inventory the library first but that would be a
simple 1 line addition.  Also I have my catalogs setup oddly.  I have a set
of tapes that are labeled CC1000.  My script finds a tape in the robot
(which is TLD) that starts with the CC label then executes a backup to that
specific tape.  It then places and entry in a file for tape removal pumps
out an e-mail message out indicating the tape is ready for removal.

I have used AutoIT to write an entire set of tools that allow the tape
librarians to perform a number of tasks on the master without logging into
it.  Commands and data are passed back and forth via a file share.  No other
security configuration.  If you are interested I can share and could
probably be persuaded to modify it enough to do exactly what you want.

Here is what the script looks like. (this is only main body.)
DoneRemove:
        RunWait, %comspec% /c "%verpath%%vmpath%vmquery" -pn %checkpool% -b
>%homepath%cat.tmp, , Hide
        FileAppend, end, %homepath%cat.tmp
        EnvAdd, loope, 3
Topspot:
        FileReadline, line, %homepath%cat.tmp, %loope%
        IfEqual, line, end, Exit
        StringLeft, tape, line, 6
        StringTrimLeft, leftline, line, 15
        StringLeft, robot, leftline, 3
        IfNotEqual, robot, tld, Goto, Next
        ;StringTrimLeft, robnumleft, leftline, 9
        ;StringLeft, robnum, robnumleft, 1
        ;IfNotEqual, robnum, 0, Goto, Next
        StringLeft, label, tape, 2
        IfEqual, label, CC, Goto, pickcat
        ;FileAppend, %tape%\n, %homepath%cattape.dat
        EnvAdd, loopf, 1
        EnvAdd, loope, 1
        Goto, Topspot
pickcat:
        RunWait, %comspec% /c "%verpath%%nbupath%bpbackupdb" -ev %tape% -d
hcart, , Hide
        Gosub, MessageFile
        ;, , Hide
        RunWait, %comspec% /c blat  %msgfile% -t %archive% -s
"%Date%-%Time%|N2KNBUMAS01||||||Database Backup" -noh2, , Hide
        IfEqual, A_WDAY, 1, Goto, Exiter
        IfEqual, A_WDAY, 7, Goto, Exiter
        IfGreater, A_HOUR, 17, Goto, Exiter
        IniWrite, YES, %homepath%%rotatefile%, Rotation, %tape%
        FileAppend, %tape%\, Netbackup Catalog Tape-4 Days Off-site\,
Replace with CC Scratch, %msgfile%
        IfLess, A_HOUR, 5, Goto, Exiter
        RunWait, %comspec% /c blat %msgfile% -t %tapet% -s "Tape Rotation",
, Hide
        Goto, Exiter
        Next:
                EnvAdd, loope, 1
                Goto, Topspot

Exiter:
        
LogTapes:
Gosub, Cleanup
        
                
Exit

;****
InfoParse:
FindFinish:
FoundEnd:
RunWait, %comspec% /c del %logfile%, , Hide
Return
Exit



CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, 
is for the sole use of the intended recipient(s) and may contain confidential
and privileged information or otherwise protected by law.  Any unauthorized
review, use, disclosure or distribution is prohibited.  If you are not the
intended recipient, please contact the sender by reply e-mail and destroy
all copies of the original message.
------_=_NextPart_001_01C3F17D.FD77640F
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; charset=3DUS-ASCI=
I">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version 5.5.2657.7=
3">
<TITLE>RE: [Veritas-bu] Catalog Script Needed</TITLE>
</HEAD>
<BODY>

<P ALIGN=3DLEFT><FONT COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">I have on=
e that is written in AutoIT.&nbsp; AutoIT is a</FONT> <FONT COLOR=3D"#000=
080" SIZE=3D2 FACE=3D"Arial">free</FONT> <FONT COLOR=3D"#000080" SIZE=3D2=
 FACE=3D"Arial">scripting language</FONT><FONT COLOR=3D"#000080" SIZE=3D2=
 FACE=3D"Arial">.&nbsp; The website is</FONT> <A HREF=3D"http://www.hidde=
nsoft.com"><U><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial">http://</FO=
NT></U><U><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Arial">www.hiddensoft.=
com</FONT></U></A></P>

<P ALIGN=3DLEFT><FONT COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">They are =
in final beta of AutoIT V3 but it is a radical rewrite of the language.&n=
bsp; I haven</FONT><FONT COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">'</FON=
T><FONT COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">t looked at learning it=
 yet.&nbsp; The nice thing about autoIT is</FONT> <FONT COLOR=3D"#000080"=
 SIZE=3D2 FACE=3D"Arial">that</FONT><FONT COLOR=3D"#000080" SIZE=3D2 FACE=
=3D"Arial"> you don</FONT><FONT COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial"=
>'</FONT><FONT COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">t have to instal=
l it on the server.&nbsp; It can compile the scripts into an executable w=
hich can be run anywhere.&nbsp; </FONT></P>

<P ALIGN=3DLEFT><FONT COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">My script=
</FONT> <FONT COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">doesn</FONT><FONT=
 COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">'</FONT><FONT COLOR=3D"#000080=
" SIZE=3D2 FACE=3D"Arial">t currently inventory the</FONT> <FONT COLOR=3D=
"#000080" SIZE=3D2 FACE=3D"Arial">library</FONT><FONT COLOR=3D"#000080" S=
IZE=3D2 FACE=3D"Arial"> first but that would be a simple 1 line addition.=
&nbsp; Also I have my catalogs setup oddly.&nbsp; I</FONT> <FONT COLOR=3D=
"#000080" SIZE=3D2 FACE=3D"Arial">have a set of tapes that are labeled CC=
1000.&nbsp; My script finds a tape in the robot (which is TLD) that start=
s with the CC label then executes a backup to that specific tape.&nbsp; I=
t</FONT> <FONT COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">then places and =
entry in a file for tape removal pumps out an e-mail message out indicati=
ng the tape is ready for removal.</FONT></P>

<P ALIGN=3DLEFT><FONT COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">I have us=
ed AutoIT to write an entire set of tools that allow the tape librarians =
to perform a number of tasks on the master without logging into it.&nbsp;=
 Commands and data are passed back and forth via a file share.&nbsp; No o=
ther security configuration.</FONT><FONT COLOR=3D"#000080" SIZE=3D2 FACE=3D=
"Arial">&nbsp; If you are interested I can share and could probably be pe=
rsuaded to modify it enough to do exactly what you want.</FONT></P>

<P ALIGN=3DLEFT><FONT COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">Here is w=
hat the script look</FONT><FONT COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial"=
>s</FONT><FONT COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial"> like.</FONT><FO=
NT COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial"> (this is only main body.)</=
FONT></P>

<P ALIGN=3DLEFT><FONT COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">DoneRemov=
e:</FONT></P>

<P ALIGN=3DLEFT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR=3D=
"#000080" SIZE=3D2 FACE=3D"Arial">RunWait, %comspec% /c &quot;%verpath%%v=
mpath%vmquery&quot; -pn %checkpool% -b &gt;%homepath%cat.tmp, , Hide</FON=
T></P>

<P ALIGN=3DLEFT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR=3D=
"#000080" SIZE=3D2 FACE=3D"Arial">FileAppend, end, %homepath%cat.tmp</FON=
T></P>

<P ALIGN=3DLEFT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR=3D=
"#000080" SIZE=3D2 FACE=3D"Arial">EnvAdd, loope, 3</FONT></P>

<P ALIGN=3DLEFT><FONT COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">Topspot:<=
/FONT></P>

<P ALIGN=3DLEFT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR=3D=
"#000080" SIZE=3D2 FACE=3D"Arial">FileReadline, line, %homepath%cat.tmp, =
%loope%</FONT></P>

<P ALIGN=3DLEFT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR=3D=
"#000080" SIZE=3D2 FACE=3D"Arial">IfEqual, line, end, Exit</FONT></P>

<P ALIGN=3DLEFT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR=3D=
"#000080" SIZE=3D2 FACE=3D"Arial">StringLeft, tape, line, 6</FONT></P>

<P ALIGN=3DLEFT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR=3D=
"#000080" SIZE=3D2 FACE=3D"Arial">StringTrimLeft, leftline, line, 15</FON=
T></P>

<P ALIGN=3DLEFT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR=3D=
"#000080" SIZE=3D2 FACE=3D"Arial">StringLeft, robot, leftline, 3</FONT></=
P>

<P ALIGN=3DLEFT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR=3D=
"#000080" SIZE=3D2 FACE=3D"Arial">IfNotEqual, robot, tld, Goto, Next</FON=
T></P>

<P ALIGN=3DLEFT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR=3D=
"#000080" SIZE=3D2 FACE=3D"Arial">;StringTrimLeft, robnumleft, leftline, =
9</FONT></P>

<P ALIGN=3DLEFT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR=3D=
"#000080" SIZE=3D2 FACE=3D"Arial">;StringLeft, robnum, robnumleft, 1</FON=
T></P>

<P ALIGN=3DLEFT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR=3D=
"#000080" SIZE=3D2 FACE=3D"Arial">;IfNotEqual, robnum, 0, Goto, Next</FON=
T></P>

<P ALIGN=3DLEFT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR=3D=
"#000080" SIZE=3D2 FACE=3D"Arial">StringLeft, label, tape, 2</FONT></P>

<P ALIGN=3DLEFT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR=3D=
"#000080" SIZE=3D2 FACE=3D"Arial">IfEqual, label, CC, Goto, pickcat</FONT=
></P>

<P ALIGN=3DLEFT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR=3D=
"#000080" SIZE=3D2 FACE=3D"Arial">;FileAppend, %tape%\n, %homepath%cattap=
e.dat</FONT></P>

<P ALIGN=3DLEFT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR=3D=
"#000080" SIZE=3D2 FACE=3D"Arial">EnvAdd, loopf, 1</FONT></P>

<P ALIGN=3DLEFT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR=3D=
"#000080" SIZE=3D2 FACE=3D"Arial">EnvAdd, loope, 1</FONT></P>

<P ALIGN=3DLEFT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR=3D=
"#000080" SIZE=3D2 FACE=3D"Arial">Goto, Topspot</FONT></P>

<P ALIGN=3DLEFT><FONT COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">pickcat:<=
/FONT></P>

<P ALIGN=3DLEFT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR=3D=
"#000080" SIZE=3D2 FACE=3D"Arial">RunWait, %comspec% /c &quot;%verpath%%n=
bupath%bpbackupdb&quot; -ev %tape% -d hcart, , Hide</FONT></P>

<P ALIGN=3DLEFT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR=3D=
"#000080" SIZE=3D2 FACE=3D"Arial">Gosub, MessageFile</FONT></P>

<P ALIGN=3DLEFT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR=3D=
"#000080" SIZE=3D2 FACE=3D"Arial">;, , Hide</FONT></P>

<P ALIGN=3DLEFT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR=3D=
"#000080" SIZE=3D2 FACE=3D"Arial">RunWait, %comspec% /c blat&nbsp; %msgfi=
le% -t %archive% -s &quot;%Date%-%Time%|N2KNBUMAS01||||||Database Backup&=
quot; -noh2, , Hide</FONT></P>

<P ALIGN=3DLEFT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR=3D=
"#000080" SIZE=3D2 FACE=3D"Arial">IfEqual, A_WDAY, 1, Goto, Exiter</FONT>=
</P>

<P ALIGN=3DLEFT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR=3D=
"#000080" SIZE=3D2 FACE=3D"Arial">IfEqual, A_WDAY, 7, Goto, Exiter</FONT>=
</P>

<P ALIGN=3DLEFT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR=3D=
"#000080" SIZE=3D2 FACE=3D"Arial">IfGreater, A_HOUR, 17, Goto, Exiter</FO=
NT></P>

<P ALIGN=3DLEFT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR=3D=
"#000080" SIZE=3D2 FACE=3D"Arial">IniWrite, YES, %homepath%%rotatefile%, =
Rotation, %tape%</FONT></P>

<P ALIGN=3DLEFT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR=3D=
"#000080" SIZE=3D2 FACE=3D"Arial">FileAppend, %tape%\, Netbackup Catalog =
Tape-4 Days Off-site\, Replace with CC Scratch, %msgfile%</FONT></P>

<P ALIGN=3DLEFT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR=3D=
"#000080" SIZE=3D2 FACE=3D"Arial">IfLess, A_HOUR, 5, Goto, Exiter</FONT><=
/P>

<P ALIGN=3DLEFT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR=3D=
"#000080" SIZE=3D2 FACE=3D"Arial">RunWait, %comspec% /c blat %msgfile% -t=
 %tapet% -s &quot;Tape Rotation&quot;, , Hide</FONT></P>

<P ALIGN=3DLEFT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR=3D=
"#000080" SIZE=3D2 FACE=3D"Arial">Goto, Exiter</FONT></P>

<P ALIGN=3DLEFT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR=3D=
"#000080" SIZE=3D2 FACE=3D"Arial">Next:</FONT></P>

<P ALIGN=3DLEFT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR=3D"#000080" SIZE=3D2 FACE=3D"Ari=
al">EnvAdd, loope, 1</FONT></P>

<P ALIGN=3DLEFT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT COLOR=3D"#000080" SIZE=3D2 FACE=3D"Ari=
al">Goto, Topspot</FONT></P>

<P ALIGN=3DLEFT><FONT COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">Exiter:</=
FONT></P>

<P ALIGN=3DLEFT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </P>

<P ALIGN=3DLEFT><FONT COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">LogTapes:=
</FONT></P>

<P ALIGN=3DLEFT><FONT COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">Gosub, Cl=
eanup</FONT></P>

<P ALIGN=3DLEFT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </P>

<P ALIGN=3DLEFT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp; </P>

<P ALIGN=3DLEFT><FONT COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">Exit</FON=
T></P>

<P ALIGN=3DLEFT><FONT COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">;****</FO=
NT></P>

<P ALIGN=3DLEFT><FONT COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">InfoParse=
:</FONT></P>

<P ALIGN=3DLEFT><FONT COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">FindFinis=
h:</FONT></P>

<P ALIGN=3DLEFT><FONT COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">FoundEnd:=
</FONT></P>

<P ALIGN=3DLEFT><FONT COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">RunWait, =
%comspec% /c del %logfile%, , Hide</FONT></P>

<P ALIGN=3DLEFT><FONT COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">Return</F=
ONT></P>

<P ALIGN=3DLEFT><FONT COLOR=3D"#000080" SIZE=3D2 FACE=3D"Arial">Exit</FON=
T></P>

</BODY>
</HTML>

<BR>
CONFIDENTIALITY NOTICE: This e-mail message, including any attachments,=20
is for the sole use of the intended recipient(s) and may contain confiden=
tial
and privileged information or otherwise be protected by law.  Any unautho=
rized
review, use, disclosure or distribution is prohibited.  If you are not th=
e
intended recipient, please contact the sender by reply e-mail and destroy
all copies of the original message.


------_=_NextPart_001_01C3F17D.FD77640F--

<Prev in Thread] Current Thread [Next in Thread>