Veritas-bu

[Veritas-bu] Scripting Help

2002-01-08 17:55:32
Subject: [Veritas-bu] Scripting Help
From: hzakir AT swbanktx DOT com (Huzefa Zakir)
Date: Tue, 8 Jan 2002 16:55:32 -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_01C19897.933DF780
Content-Type: text/plain;
        charset="iso-8859-1"

Hello,

I have wrote the following script below to change expiration time on media
to expire on the entered start date.
I am fairly new with scripting, so if someone can assist me in de-bugging
the script, I will greatly appreciate it.
Let me briefly explain what I am trying to do....
I read in the "start" and the "end" date, and take those vaules and put them
in the bpimagelist command.
then I run the bpexpdate command to expire those media's

But I am running into one problem, I can't use the "start" value with the
bpexpdate command, because it's not the expiration date.
If someone has created a script to expire media, please also let.
Thanks,




# !/usr/bin/ksh
BPIMAGELIST=/usr/openv/netbackup/bin/admincmd/bpimagelist
BPEXPDATE=/usr/openv/netbackup/bin/admincmd/bpexpdate
echo "Enter Start Date: "
read start
echo "Enter End Date: "
read end

    for i in `$BPIMAGELIST -media -d $start -e $end -U
|(line>/dev/null;line>/dev/null;tee)|awk '{print $1}'`
     do
        echo  "$BPEXPDATE -ev $i -d $start 08:00:00 -force" |awk '{print
$3}'
        echo "Do you want to continue (Y/N)?"
    read ans
      if [ "$ans" = ["Yy"] ]
        then
         echo "processing script....."
         `$BPEXPDATE -ev $i -d $start 08:00:00 -force`
      elif [ "$ans" = ["Nn"] ]
       then
         echo "Script Aborted"
       exit
      fi
     done

Huzefa Zakir
IT Systems  Engineer
*  hzakir AT swbanktx DOT com










CONFIDENTIALITY NOTICE:

************************************************************************

The information contained in this ELECTRONIC MAIL transmission
is confidential.  It may also be privileged work product or proprietary
information. This information is intended for the exclusive use of the
addressee(s).  If you are not the intended recipient, you are hereby
notified that any use, disclosure, dissemination, distribution [other
than to the addressee(s)], copying or taking of any action because
of this information is strictly prohibited.

************************************************************************

------_=_NextPart_001_01C19897.933DF780
Content-Type: text/html; charset="iso-8859-1"
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=3Diso-8859-=
1">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version 5.5.2653.12">
<TITLE>Scripting Help </TITLE>
</HEAD>
<BODY>

<P><FONT SIZE=3D2 FACE=3D"Arial">Hello,</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">I have wrote the following script below to=
 change expiration time on media to expire on the entered start date.</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">I am fairly new with scripting, so if som=
eone can assist me in de-bugging the script, I will greatly appreciate it.<=
/FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">Let me briefly explain what I am trying t=
o do....</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">I read in the &quot;start&quot; and the &=
quot;end&quot; date, and take those vaules and put them in the bpimagelist =
command.</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">then I run the bpexpdate command to expir=
e those media's</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">But I am running into one problem, I can't=
 use the &quot;start&quot; value with the bpexpdate command, because it's n=
ot the expiration date.</FONT></P>

<P><FONT SIZE=3D2 FACE=3D"Arial">If someone has created a script to expire =
media, please also let.</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">Thanks,</FONT>
</P>
<BR>
<BR>
<BR>

<P><FONT SIZE=3D2 FACE=3D"Arial"># !/usr/bin/ksh</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">BPIMAGELIST=3D/usr/openv/netbackup/bin/ad=
mincmd/bpimagelist</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">BPEXPDATE=3D/usr/openv/netbackup/bin/admi=
ncmd/bpexpdate</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">echo &quot;Enter Start Date: &quot;</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">read start</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">echo &quot;Enter End Date: &quot;</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">read end</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">&nbsp;&nbsp;&nbsp; for i in `$BPIMAGELIST =
-media -d $start -e $end -U |(line&gt;/dev/null;line&gt;/dev/null;tee)|awk =
'{print $1}'`</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp; do</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
; echo&nbsp; &quot;$BPEXPDATE -ev $i -d $start 08:00:00 -force&quot; |awk '=
{print $3}'</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
; echo &quot;Do you want to continue (Y/N)?&quot;</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp;&nbsp;&nbsp; read ans</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if [ &quot=
;$ans&quot; =3D [&quot;Yy&quot;] ]</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
; then</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp; echo &quot;processing script.....&quot;</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp; `$BPEXPDATE -ev $i -d $start 08:00:00 -force`</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; elif [ &qu=
ot;$ans&quot; =3D [&quot;Nn&quot;] ]</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; then=
</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp; echo &quot;Script Aborted&quot;</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit=
</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fi</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">&nbsp;&nbsp;&nbsp;&nbsp; done</FONT>
</P>

<P><B><FONT COLOR=3D"#666699" FACE=3D"Arial Rounded MT Bold">Huzefa Zakir</=
FONT></B>
<BR><I><FONT COLOR=3D"#666699" SIZE=3D2 FACE=3D"Arial Rounded MT Bold">IT S=
ystems&nbsp; Engineer</FONT></I>
<BR><FONT COLOR=3D"#0000FF" SIZE=3D2 FACE=3D"Wingdings">-</FONT><FONT SIZE=
=3D2 FACE=3D"Arial Rounded MT Bold">&nbsp; </FONT><FONT COLOR=3D"#666699" S=
IZE=3D2 FACE=3D"Arial Rounded MT Bold">hzakir AT swbanktx DOT com</FONT>
</P>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>

<CODE><FONT SIZE=3D3><BR>
<BR>
CONFIDENTIALITY NOTICE:<BR>
<BR>
************************************************************************<BR>
<BR>
The information contained in this ELECTRONIC MAIL transmission<BR>
is confidential.  It may also be privileged work product or proprietary<BR>
information. This information is intended for the exclusive use of the<BR>
addressee(s).  If you are not the intended recipient, you are hereby<BR>
notified that any use, disclosure, dissemination, distribution [other<BR>
than to the addressee(s)], copying or taking of any action because<BR>
of this information is strictly prohibited.<BR>
<BR>
************************************************************************<BR>
</FONT></CODE></BODY>
</HTML>
------_=_NextPart_001_01C19897.933DF780--

<Prev in Thread] Current Thread [Next in Thread>
  • [Veritas-bu] Scripting Help, Huzefa Zakir <=