Veritas-bu

[Veritas-bu] windows script convert from unix

2002-11-13 08:25:22
Subject: [Veritas-bu] windows script convert from unix
From: kmarx AT trigon DOT com (Marx, Keath)
Date: Wed, 13 Nov 2002 08:25:22 -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_01C28B18.1EA75B47
Content-Type: text/plain

Really for working in windows I have found the easiest thing to do is use a
program called AutoIT (freeware to be found at http://www.hiddensoft.com
<http://www.hiddensoft.com/> ) It is a very robust scripting language.  Use
the same commands as your unix side (99% of my scripts have been made by
finding a unix script that does what I want and then working up an autoit
script that does the same.)  dump the output to file and autoIT has parsing
commands to figure it out.
 
-----Original Message-----
From: David Markham [mailto:dave.markham AT icl DOT net] 
Sent: Wednesday, November 13, 2002 7:02 AM
To: 'Veritas-Bu (E-mail)
Subject: [Veritas-bu] windows script convert from unix
 
Hi,
 
I currently have this script which runs from cron on a unix server and I
need to do a similar thing for a guy using Netbackup 4.5 on windows 2000.
 
Is there anyone who can convert this or help? I don't know how to program in
.bat 
 
Current unix version is 3.2
 
script --------------------------------------------------
 
#!/usr/bin/sh
#set -x
 
##Auto_ScratchPool
## This script is used to identify all tapes in the robot which are
available
## for use (all expired images) but are not in the "ScratchPool" and change
## them to be in the Scratchpool.  This should increase tape availability
for
## all Classes of backups.
 
## Mark Donaldson - Nov 11, 1999
## Hacked by Dave M for rbos 12/06/02
 
PATH=$PATH:/usr/openv/netbackup/bin:/usr/openv/volmgr/bin:/usr/local/bin
PATH=$PATH:/usr/openv/netbackup/bin/admincmd:/usr/openv/local
export PATH
 
#Get Scratchpool name
SPname=`vmpool -listscratch | tail -1`
 
#Now lookup scratchpool pool number.
#SPnum=2
SPnum=`vmpool -listall | awk -F: '$1=="pool number" {pn=$2} $1=="pool name"
&& $
2~/^ *'$SPname'$/ {print pn}'`
 
# Note: vmquery col  1 is tape number
#               col  3 is tape type
#               col 12 is poolname
#               col 20 is "assigned" date
 
## This works
 
## For NB 3.4 00/00/00 needs to be 00/00/0000
tapelist=`vmquery -a -w |  awk '$3 !~ /CLN/ && $20 == "00/00/00" && $12 !=
"'$SP
name'" &&  $28 == 0 {print $1}'`
 
for eachtape in $tapelist
do
  #Tape available for reassignment to scratchpool.
  vmchange -p $SPnum -m $eachtape
done
 
exit

------_=_NextPart_001_01C28B18.1EA75B47
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns=3D"http://www.w3.org/TR/REC-html40";>

<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3DUS-ASCII">




<meta name=3DProgId content=3DWord.Document>
<meta name=3DGenerator content=3D"Microsoft Word 10">
<meta name=3DOriginator content=3D"Microsoft Word 10">
<link rel=3DFile-List href=3D"cid:[email protected]">
<!--[if gte mso 9]><xml>
 <o:OfficeDocumentSettings>
  <o:DoNotRelyOnCSS/>
 </o:OfficeDocumentSettings>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:SpellingState>Clean</w:SpellingState>
  <w:GrammarState>Clean</w:GrammarState>
  <w:DocumentKind>DocumentEmail</w:DocumentKind>
  <w:EnvelopeVis/>
  <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
 </w:WordDocument>
</xml><![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;
        mso-font-charset:0;
        mso-generic-font-family:swiss;
        mso-font-pitch:variable;
        mso-font-signature:553679495 -2147483648 8 0 66047 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {mso-style-parent:"";
        margin:0in;
        margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:12.0pt;
        font-family:"Times New Roman";
        mso-fareast-font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;
        text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;
        text-underline:single;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        mso-style-noshow:yes;
        mso-ansi-font-size:10.0pt;
        mso-bidi-font-size:10.0pt;
        font-family:Arial;
        mso-ascii-font-family:Arial;
        mso-hansi-font-family:Arial;
        mso-bidi-font-family:Arial;
        color:navy;}
span.SpellE
        {mso-style-name:"";
        mso-spl-e:yes;}
span.GramE
        {mso-style-name:"";
        mso-gram-e:yes;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;
        mso-header-margin:.5in;
        mso-footer-margin:.5in;
        mso-paper-source:0;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 10]>
<style>
 /* Style Definitions */=20
 table.MsoNormalTable
        {mso-style-name:"Table Normal";
        mso-tstyle-rowband-size:0;
        mso-tstyle-colband-size:0;
        mso-style-noshow:yes;
        mso-style-parent:"";
        mso-padding-alt:0in 5.4pt 0in 5.4pt;
        mso-para-margin:0in;
        mso-para-margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:10.0pt;
        font-family:"Times New Roman";}
</style>
<![endif]-->
</head>

<body lang=3DEN-US link=3Dblue vlink=3Dpurple =
style=3D'tab-interval:.5in'>

<div class=3DSection1>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Really for working in windows I =
have found
the easiest thing to do is use a program called <span =
class=3DSpellE>AutoIT</span>
(freeware to be found at <a =
href=3D"http://www.hiddensoft.com/";>http://www.hiddensoft.com</a>)
<span class=3DGramE>It</span> is a very robust scripting language.<span
style=3D'mso-spacerun:yes'>&nbsp; </span>Use the same commands as your =
<span
class=3DSpellE><span class=3DGramE>unix</span></span> side (99% of my =
scripts have
been made by finding a <span class=3DSpellE>unix</span> script that =
does what I
want and then working up an <span class=3DSpellE>autoit</span> script =
that does
the same.)<span style=3D'mso-spacerun:yes'>&nbsp; </span><span =
class=3DGramE>dump</span>
the output to file and <span class=3DSpellE>autoIT</span> has parsing =
commands to
figure it out.<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>=


<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DTahoma><span
style=3D'font-size:10.0pt;font-family:Tahoma'>-----Original =
Message-----<br>
<b><span style=3D'font-weight:bold'>From:</span></b> David Markham
[mailto:dave.markham AT icl DOT net] <br>
<b><span style=3D'font-weight:bold'>Sent:</span></b> Wednesday, =
November 13, 2002
7:02 AM<br>
<b><span style=3D'font-weight:bold'>To:</span></b> 'Veritas-Bu =
(E-mail)<br>
<b><span style=3D'font-weight:bold'>Subject:</span></b> [Veritas-bu] =
windows
script convert from unix</span></font></p>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
face=3D"Times New Roman"><span
style=3D'font-size:12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>Hi,</span></font><o:p></o:p=
></p>

</div>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
face=3D"Times New Roman"><span
style=3D'font-size:12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>I currently have this =
script which
runs from cron on a unix server and I need to do a similar thing for a =
guy
using Netbackup 4.5 on windows 2000.</span></font><o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
face=3D"Times New Roman"><span
style=3D'font-size:12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>Is there anyone who can =
convert this
or help? I don't know how to program in .bat =
</span></font><o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
face=3D"Times New Roman"><span
style=3D'font-size:12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>Current unix version is =
3.2</span></font><o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
face=3D"Times New Roman"><span
style=3D'font-size:12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>script
--------------------------------------------------</span></font><o:p></o=
:p></p>

</div>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
face=3D"Times New Roman"><span
style=3D'font-size:12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>#!/usr/bin/sh</span></font>=
<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>#set =
-x</span></font><o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
face=3D"Times New Roman"><span
style=3D'font-size:12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>##Auto_ScratchPool<br>
## This script is used to identify all tapes in the robot which are =
available<br>
## for use (all expired images) but are not in the =
&quot;ScratchPool&quot; and
change<br>
## them to be in the Scratchpool.&nbsp; This should increase tape =
availability
for<br>
## all Classes of backups.</span></font><o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
face=3D"Times New Roman"><span
style=3D'font-size:12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>## Mark Donaldson - Nov =
11, 1999<br>
## Hacked by Dave M for rbos 12/06/02</span></font><o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
face=3D"Times New Roman"><span
style=3D'font-size:12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>PATH=3D$PATH:/usr/openv/net=
backup/bin:/usr/openv/volmgr/bin:/usr/local/bin<br>
PATH=3D$PATH:/usr/openv/netbackup/bin/admincmd:/usr/openv/local<br>
export PATH</span></font><o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
face=3D"Times New Roman"><span
style=3D'font-size:12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>#Get Scratchpool name<br>
SPname=3D`vmpool -listscratch | tail -1`</span></font><o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
face=3D"Times New Roman"><span
style=3D'font-size:12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>#Now lookup scratchpool =
pool number.<br>
#SPnum=3D2<br>
SPnum=3D`vmpool -listall | awk -F: '$1=3D=3D&quot;pool number&quot; =
{pn=3D$2}
$1=3D=3D&quot;pool name&quot; &amp;&amp; $<br>
2~/^ *'$SPname'$/ {print pn}'`</span></font><o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
face=3D"Times New Roman"><span
style=3D'font-size:12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'># Note: vmquery col&nbsp; =
1 is tape
number<br>
#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;
col&nbsp; 3 is tape type<br>
#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;
col 12 is poolname<br>
#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;
col 20 is &quot;assigned&quot; date</span></font><o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
face=3D"Times New Roman"><span
style=3D'font-size:12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>## This =
works</span></font><o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
face=3D"Times New Roman"><span
style=3D'font-size:12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>## For NB 3.4 00/00/00 =
needs to be
00/00/0000<br>
tapelist=3D`vmquery -a -w |&nbsp; awk '$3 !~ /CLN/ &amp;&amp; $20 =
=3D=3D
&quot;00/00/00&quot; &amp;&amp; $12 !=3D &quot;'$SP<br>
name'&quot; &amp;&amp;&nbsp; $28 =3D=3D 0 {print =
$1}'`</span></font><o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
face=3D"Times New Roman"><span
style=3D'font-size:12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>for eachtape in =
$tapelist<br>
do<br>
&nbsp; #Tape available for reassignment to scratchpool.<br>
&nbsp; vmchange -p $SPnum -m $eachtape<br>
done</span></font><o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D3 =
face=3D"Times New Roman"><span
style=3D'font-size:12.0pt'>&nbsp;<o:p></o:p></span></font></p>

</div>

<div>

<p class=3DMsoNormal style=3D'margin-left:.5in'><font size=3D2 =
face=3DArial><span
style=3D'font-size:10.0pt;font-family:Arial'>exit</span></font><o:p></o:=
p></p>

</div>

</div>

</body>

</html>

------_=_NextPart_001_01C28B18.1EA75B47--

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