Veritas-bu

[Veritas-bu] windows script convert from unix

2002-11-13 07:01:43
Subject: [Veritas-bu] windows script convert from unix
From: dave.markham AT icl DOT net (David Markham)
Date: Wed, 13 Nov 2002 12:01:43 -0000
This is a multi-part message in MIME format.

------=_NextPart_000_003D_01C28B0C.6FB81A80
Content-Type: text/plain;
        charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

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_000_003D_01C28B0C.6FB81A80
Content-Type: text/html;
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Diso-8859-1">


<META content=3D"MSHTML 6.00.2800.1106" name=3DGENERATOR></HEAD>
<BODY>
<DIV><SPAN class=3D514145911-13112002><FONT face=3DArial=20
size=3D2>Hi,</FONT></SPAN></DIV>
<DIV><SPAN class=3D514145911-13112002><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D514145911-13112002><FONT face=3DArial size=3D2>I =
currently have=20
this script which runs from cron on a unix server and I need to do a =
similar=20
thing for a guy using Netbackup 4.5 on windows 2000.</FONT></SPAN></DIV>
<DIV><SPAN class=3D514145911-13112002><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D514145911-13112002><FONT face=3DArial size=3D2>Is =
there anyone who=20
can convert this or help? I don't know how to program in .bat=20
</FONT></SPAN></DIV>
<DIV><SPAN class=3D514145911-13112002><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D514145911-13112002><FONT face=3DArial =
size=3D2>Current unix version=20
is 3.2</FONT></SPAN></DIV>
<DIV><SPAN class=3D514145911-13112002><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D514145911-13112002><FONT face=3DArial size=3D2>script =

--------------------------------------------------</FONT></SPAN></DIV>
<DIV><SPAN class=3D514145911-13112002><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D514145911-13112002><FONT face=3DArial=20
size=3D2>#!/usr/bin/sh</FONT></SPAN></DIV>
<DIV><SPAN class=3D514145911-13112002><FONT face=3DArial size=3D2>#set=20
-x</FONT></SPAN></DIV>
<DIV><SPAN class=3D514145911-13112002><FONT face=3DArial=20
size=3D2></FONT></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D514145911-13112002><FONT face=3DArial=20
size=3D2>##Auto_ScratchPool<BR>## This script is used to identify all =
tapes in the=20
robot which are available<BR>## for use (all expired images) but are not =
in the=20
"ScratchPool" and change<BR>## them to be in the Scratchpool.&nbsp; This =
should=20
increase tape availability for<BR>## all Classes of =
backups.</FONT></SPAN></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><SPAN class=3D514145911-13112002><FONT face=3DArial size=3D2>## =
Mark Donaldson -=20
Nov 11, 1999<BR>## Hacked by Dave M for rbos =
12/06/02</FONT></SPAN></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><SPAN class=3D514145911-13112002><FONT face=3DArial=20
size=3D2>PATH=3D$PATH:/usr/openv/netbackup/bin:/usr/openv/volmgr/bin:/usr=
/local/bin<BR>PATH=3D$PATH:/usr/openv/netbackup/bin/admincmd:/usr/openv/l=
ocal<BR>export=20
PATH</FONT></SPAN></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><SPAN class=3D514145911-13112002><FONT face=3DArial size=3D2>#Get =
Scratchpool=20
name<BR>SPname=3D`vmpool -listscratch | tail -1`</FONT></SPAN></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><SPAN class=3D514145911-13112002><FONT face=3DArial size=3D2>#Now =
lookup=20
scratchpool pool number.<BR>#SPnum=3D2<BR>SPnum=3D`vmpool -listall | awk =
-F:=20
'$1=3D=3D"pool number" {pn=3D$2} $1=3D=3D"pool name" &amp;&amp; =
$<BR>2~/^ *'$SPname'$/=20
{print pn}'`</FONT></SPAN></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><SPAN class=3D514145911-13112002><FONT face=3DArial size=3D2># =
Note: vmquery=20
col&nbsp; 1 is tape=20
number<BR>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;=20
col&nbsp; 3 is tape=20
type<BR>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;=20
col 12 is=20
poolname<BR>#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;=20
col 20 is "assigned" date</FONT></SPAN></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><SPAN class=3D514145911-13112002><FONT face=3DArial size=3D2>## =
This=20
works</FONT></SPAN></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><SPAN class=3D514145911-13112002><FONT face=3DArial size=3D2>## For =
NB 3.4=20
00/00/00 needs to be 00/00/0000<BR>tapelist=3D`vmquery -a -w |&nbsp; awk =
'$3 !~=20
/CLN/ &amp;&amp; $20 =3D=3D "00/00/00" &amp;&amp; $12 !=3D =
"'$SP<BR>name'"=20
&amp;&amp;&nbsp; $28 =3D=3D 0 {print $1}'`</FONT></SPAN></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><SPAN class=3D514145911-13112002><FONT face=3DArial size=3D2>for =
eachtape in=20
$tapelist<BR>do<BR>&nbsp; #Tape available for reassignment to=20
scratchpool.<BR>&nbsp; vmchange -p $SPnum -m=20
$eachtape<BR>done</FONT></SPAN></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><SPAN class=3D514145911-13112002><FONT face=3DArial=20
size=3D2>exit<BR></FONT></SPAN></DIV></BODY></HTML>

------=_NextPart_000_003D_01C28B0C.6FB81A80--


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