Veritas-bu

[Veritas-bu] Summary: relating files and images to tapes

2002-04-19 13:48:18
Subject: [Veritas-bu] Summary: relating files and images to tapes
From: Mark.Donaldson AT experianems DOT com (Donaldson, Mark)
Date: Fri, 19 Apr 2002 11:48:18 -0600
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_01C1E7CA.63DB21C0
Content-Type: text/plain

Here's the verison with processing for the bpimmedia options.
-Mark

#!/bin/ksh
export PATH=$PATH:/usr/openv/netbackup/bin/admincmd
if [ -z "$1" ]
then
  echo "Usage: `basename $0` [bpimmedia options] image_name ..."
else
  #Option processing
  optionlist=""
  while [ "`echo "$1" | cut -c1`" = "-" ]
  do
    case $1 in
    "-l"|"-L"|"-verbose" )
      # Discard these options
      shift
      ;;
    "-d"|"-e" )
      # Date functions are special because of optional hours
      optionlist="$optionlist $1 $2" ; shift ; shift
      if [ `echo "$1" | cut -c1` != "-" ] ;then
        optionlist="$optionlist $1" ; shift
      fi
      ;;
    * )
      #Every other option
      optionlist="$optionlist $1 $2" ; shift ; shift
      ;;
    esac
  done

  for bpid in $*
  do
    echo "Searching for $bpid"
    bpimmedia $optionlist | \
      awk '{if ( $1=="IMAGE" ) {if ( $4=="'$bpid'" ) {flag=1} else {flag=0}
}
            else { if ( flag==1 ) { print $9 } } }'  | sort -u
  done
fi
exit

------_=_NextPart_001_01C1E7CA.63DB21C0
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3DUS-ASCII">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
5.5.2653.12">
<TITLE>RE: [Veritas-bu] Summary: relating files and images to =
tapes</TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=3D2>Here's the verison with processing for the bpimmedia =
options.</FONT>
<BR><FONT SIZE=3D2>-Mark</FONT>
</P>

<P><FONT SIZE=3D2>#!/bin/ksh</FONT>
<BR><FONT SIZE=3D2>export =
PATH=3D$PATH:/usr/openv/netbackup/bin/admincmd</FONT>
<BR><FONT SIZE=3D2>if [ -z &quot;$1&quot; ]</FONT>
<BR><FONT SIZE=3D2>then</FONT>
<BR><FONT SIZE=3D2>&nbsp; echo &quot;Usage: `basename $0` [bpimmedia =
options] image_name ...&quot;</FONT>
<BR><FONT SIZE=3D2>else</FONT>
<BR><FONT SIZE=3D2>&nbsp; #Option processing</FONT>
<BR><FONT SIZE=3D2>&nbsp; optionlist=3D&quot;&quot;</FONT>
<BR><FONT SIZE=3D2>&nbsp; while [ &quot;`echo &quot;$1&quot; | cut =
-c1`&quot; =3D &quot;-&quot; ]</FONT>
<BR><FONT SIZE=3D2>&nbsp; do</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; case $1 in</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; =
&quot;-l&quot;|&quot;-L&quot;|&quot;-verbose&quot; )</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Discard these =
options</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; shift</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;;</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; &quot;-d&quot;|&quot;-e&quot; =
)</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # Date functions are =
special because of optional hours</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
optionlist=3D&quot;$optionlist $1 $2&quot; ; shift ; shift</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if [ `echo =
&quot;$1&quot; | cut -c1` !=3D &quot;-&quot; ] ;then</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
optionlist=3D&quot;$optionlist $1&quot; ; shift</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fi</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;;</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; * )</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #Every other =
option</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
optionlist=3D&quot;$optionlist $1 $2&quot; ; shift ; shift</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;;</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; esac</FONT>
<BR><FONT SIZE=3D2>&nbsp; done</FONT>
</P>

<P><FONT SIZE=3D2>&nbsp; for bpid in $*</FONT>
<BR><FONT SIZE=3D2>&nbsp; do</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; echo &quot;Searching for =
$bpid&quot;</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp; bpimmedia $optionlist | \</FONT>
<BR><FONT SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; awk '{if ( =
$1=3D=3D&quot;IMAGE&quot; ) {if ( $4=3D=3D&quot;'$bpid'&quot; ) =
{flag=3D1} else {flag=3D0} }</FONT>
<BR><FONT =
SIZE=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp; else { if ( flag=3D=3D1 ) { print $9 } } }'&nbsp; | sort -u</FONT>
<BR><FONT SIZE=3D2>&nbsp; done</FONT>
<BR><FONT SIZE=3D2>fi</FONT>
<BR><FONT SIZE=3D2>exit</FONT>
</P>

</BODY>
</HTML>
------_=_NextPart_001_01C1E7CA.63DB21C0--