[Veritas-bu] Summary: relating files and images to tapes
2002-04-19 14:06:41
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_01C1E7CC.F566BC60
Content-Type: text/plain
There's a mistake in the previous posting below - this one works regardless
of option order:
#!/bin/ksh
export PATH=$PATH:/usr/openv/netbackup/bin/admincmd
if [ -z "$1" ]
then
echo "Usage: `basename $0` [-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
optionlist="$optionlist $1 $2" ; shift ; shift
if [ `echo "$1" | cut -c1` != "-" -a `echo "$1" | grep -c "_"` -eq 0 ]
then
optionlist="$optionlist $1" ; shift
fi
;;
* )
#Every other option
optionlist="$optionlist $1 $2" ; shift ; shift
;;
esac
done
[ -n "$optionlist" ] && echo "Optionlist=\"$optionlist\""
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
-----Original Message-----
From: Donaldson, Mark
Sent: Friday, April 19, 2002 11:48 AM
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_01C1E7CC.F566BC60
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>There's a mistake in the previous posting below - =
this one works regardless of option order:</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 "$1" ]</FONT>
<BR><FONT SIZE=3D2>then</FONT>
<BR><FONT SIZE=3D2> echo "Usage: `basename $0` [-options] =
image_name ..."</FONT>
<BR><FONT SIZE=3D2>else</FONT>
<BR><FONT SIZE=3D2> #Option processing</FONT>
<BR><FONT SIZE=3D2> optionlist=3D""</FONT>
<BR><FONT SIZE=3D2> while [ "`echo "$1" | cut =
-c1`" =3D "-" ]</FONT>
<BR><FONT SIZE=3D2> do</FONT>
<BR><FONT SIZE=3D2> case $1 in</FONT>
<BR><FONT SIZE=3D2> =
"-l"|"-L"|"-verbose" )</FONT>
<BR><FONT SIZE=3D2> # Discard these =
options</FONT>
<BR><FONT SIZE=3D2> shift</FONT>
<BR><FONT SIZE=3D2> ;;</FONT>
<BR><FONT SIZE=3D2> "-d"|"-e" =
)</FONT>
<BR><FONT SIZE=3D2> # Date functions are =
special</FONT>
<BR><FONT SIZE=3D2> =
optionlist=3D"$optionlist $1 $2" ; shift ; shift</FONT>
<BR><FONT SIZE=3D2> if [ `echo =
"$1" | cut -c1` !=3D "-" -a `echo "$1" | =
grep -c "_"` -eq 0 ]</FONT>
<BR><FONT SIZE=3D2> then</FONT>
<BR><FONT SIZE=3D2> =
optionlist=3D"$optionlist $1" ; shift</FONT>
<BR><FONT SIZE=3D2> fi</FONT>
<BR><FONT SIZE=3D2> ;;</FONT>
<BR><FONT SIZE=3D2> * )</FONT>
<BR><FONT SIZE=3D2> #Every other =
option</FONT>
<BR><FONT SIZE=3D2> =
optionlist=3D"$optionlist $1 $2" ; shift ; shift</FONT>
<BR><FONT SIZE=3D2> ;;</FONT>
<BR><FONT SIZE=3D2> esac</FONT>
<BR><FONT SIZE=3D2> done</FONT>
<BR><FONT SIZE=3D2> [ -n "$optionlist" ] && =
echo "Optionlist=3D\"$optionlist\""</FONT>
</P>
<P><FONT SIZE=3D2> for bpid in $*</FONT>
<BR><FONT SIZE=3D2> do</FONT>
<BR><FONT SIZE=3D2> echo "Searching for =
$bpid"</FONT>
<BR><FONT SIZE=3D2> bpimmedia $optionlist | \</FONT>
<BR><FONT SIZE=3D2> awk '{if ( =
$1=3D=3D"IMAGE" ) {if ( $4=3D=3D"'$bpid'" ) =
{flag=3D1} else {flag=3D0} }</FONT>
<BR><FONT =
SIZE=3D2> &nb=
sp; else { if ( flag=3D=3D1 ) { print $9 } } }' | sort -u</FONT>
<BR><FONT SIZE=3D2> done</FONT>
<BR><FONT SIZE=3D2>fi</FONT>
<BR><FONT SIZE=3D2>exit</FONT>
</P>
<P><FONT SIZE=3D2>-----Original Message-----</FONT>
<BR><FONT SIZE=3D2>From: Donaldson, Mark </FONT>
<BR><FONT SIZE=3D2>Sent: Friday, April 19, 2002 11:48 AM</FONT>
</P>
<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 "$1" ]</FONT>
<BR><FONT SIZE=3D2>then</FONT>
<BR><FONT SIZE=3D2> echo "Usage: `basename $0` [bpimmedia =
options] image_name ..."</FONT>
<BR><FONT SIZE=3D2>else</FONT>
<BR><FONT SIZE=3D2> #Option processing</FONT>
<BR><FONT SIZE=3D2> optionlist=3D""</FONT>
<BR><FONT SIZE=3D2> while [ "`echo "$1" | cut =
-c1`" =3D "-" ]</FONT>
<BR><FONT SIZE=3D2> do</FONT>
<BR><FONT SIZE=3D2> case $1 in</FONT>
<BR><FONT SIZE=3D2> =
"-l"|"-L"|"-verbose" )</FONT>
<BR><FONT SIZE=3D2> # Discard these =
options</FONT>
<BR><FONT SIZE=3D2> shift</FONT>
<BR><FONT SIZE=3D2> ;;</FONT>
<BR><FONT SIZE=3D2> "-d"|"-e" =
)</FONT>
<BR><FONT SIZE=3D2> # Date functions are =
special because of optional hours</FONT>
<BR><FONT SIZE=3D2> =
optionlist=3D"$optionlist $1 $2" ; shift ; shift</FONT>
<BR><FONT SIZE=3D2> if [ `echo =
"$1" | cut -c1` !=3D "-" ] ;then</FONT>
<BR><FONT SIZE=3D2> =
optionlist=3D"$optionlist $1" ; shift</FONT>
<BR><FONT SIZE=3D2> fi</FONT>
<BR><FONT SIZE=3D2> ;;</FONT>
<BR><FONT SIZE=3D2> * )</FONT>
<BR><FONT SIZE=3D2> #Every other =
option</FONT>
<BR><FONT SIZE=3D2> =
optionlist=3D"$optionlist $1 $2" ; shift ; shift</FONT>
<BR><FONT SIZE=3D2> ;;</FONT>
<BR><FONT SIZE=3D2> esac</FONT>
<BR><FONT SIZE=3D2> done</FONT>
</P>
<P><FONT SIZE=3D2> for bpid in $*</FONT>
<BR><FONT SIZE=3D2> do</FONT>
<BR><FONT SIZE=3D2> echo "Searching for =
$bpid"</FONT>
<BR><FONT SIZE=3D2> bpimmedia $optionlist | \</FONT>
<BR><FONT SIZE=3D2> awk '{if ( =
$1=3D=3D"IMAGE" ) {if ( $4=3D=3D"'$bpid'" ) =
{flag=3D1} else {flag=3D0} }</FONT>
<BR><FONT =
SIZE=3D2> &nb=
sp; else { if ( flag=3D=3D1 ) { print $9 } } }' | sort -u</FONT>
<BR><FONT SIZE=3D2> done</FONT>
<BR><FONT SIZE=3D2>fi</FONT>
<BR><FONT SIZE=3D2>exit</FONT>
</P>
</BODY>
</HTML>
------_=_NextPart_001_01C1E7CC.F566BC60--
|
|
|