Veritas-bu

[Veritas-bu] Back referencing active jobs from mounted tapes

2005-12-15 13:47:56
Subject: [Veritas-bu] Back referencing active jobs from mounted tapes
From: Mark.Donaldson AT cexp DOT com (Mark.Donaldson AT cexp DOT com)
Date: Thu, 15 Dec 2005 11:47:56 -0700
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_000_01C601A8.1003F37A
Content-Type: text/plain;
        charset="iso-8859-1"

Here's another potentially helpful script. 

We had a critical restore hanging the other day because the tape needed for
restore was occupied by a long-running backup.  This script can take a tape
number and return any active jobs running on it.  

The jobid can then be suspended or cancelled by you to free-up the tape.

ksh-script, sorry Windows folks...

-M




------_=_NextPart_000_01C601A8.1003F37A
Content-Type: application/octet-stream;
        name="tapes2jobs"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
        filename="tapes2jobs"

#!/bin/ksh=0A=
PATH=3D$PATH:/usr/openv/netbackup/bin/admincmd:/usr/openv/local/bin=0A=
=0A=
if [ $# -eq 0 -o "`echo $1 | cut -c1`" =3D "-" ]=0A=
then=0A=
  echo "\nReturns the active jobids for supplied tape numbers."=0A=
  echo "Usage: `basename $0` tapenum [tapenum...]\n"=0A=
  RC=3D1=0A=
else=0A=
  RC=3D0=0A=
  for tape in $*=0A=
  do=0A=
    $tape=0A=
    for jobid in `bpdbjobs -most_columns | gawk -F, '$3=3D=3D1 && =
$15!=3D"" {print $1}'`=0A=
    do=0A=
      bpdbjobs -jobid $jobid -all_columns | tr "," "\012" | \=0A=
      gawk 'BEGIN{tnum=3D""}=0A=
            { if(NR=3D=3D1){jobid=3D$1}=0A=
              if($0~" mounting "){tnum=3D$NF}=0A=
              if($0~" positioning "){tnum=3D$(NF-3)}=0A=
            }=0A=
             END {if(tnum=3D=3D"'$tape'"){print jobid}}'=0A=
    done=0A=
  done=0A=
fi=0A=
exit $RC=0A=

------_=_NextPart_000_01C601A8.1003F37A--

<Prev in Thread] Current Thread [Next in Thread>
  • [Veritas-bu] Back referencing active jobs from mounted tapes, Mark.Donaldson AT cexp DOT com <=