Veritas-bu

[Veritas-bu] bplist & '-hoursago'

2005-09-23 07:55:16
Subject: [Veritas-bu] bplist & '-hoursago'
From: scottd AT HanoverDirect DOT com (Deiter Scott)
Date: Fri, 23 Sep 2005 07:55:16 -0400
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_01C5C035.45F642F6
Content-Type: multipart/alternative;
        boundary="----_=_NextPart_001_01C5C035.45F642F6"


------_=_NextPart_001_01C5C035.45F642F6
Content-Type: text/plain

This is what we put together. It will show the path.

The name is sr  Within this directory create links with the client names.

 

-----Original Message-----
From: veritas-bu-admin AT mailman.eng.auburn DOT edu
[mailto:veritas-bu-admin AT mailman.eng.auburn DOT edu] On Behalf Of Marianne 
van
den Berg
Sent: Friday, September 23, 2005 7:27 AM
To: NBUList (E-mail)
Subject: [Veritas-bu] bplist & '-hoursago'

 

Hi 

I'm not a script writer. I need to run a bplist every morning at 7 (will do
this from cron) for each client to list all files/directories backed up in
the last 24 hours.

For some or other reason, not all NetBackup commands have the same options -
bplist does not have a '-hoursago', just a start and end date.

Does anybody have a korn or bourne shell script that can do this? 

THANKS!! 

Marianne van den Berg 


------_=_NextPart_001_01C5C035.45F642F6
Content-Type: text/html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=US-ASCII">


<meta name=Generator content="Microsoft Word 10 (filtered)">
<title>bplist &amp; '-hoursago'</title>

<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"Comic Sans MS";
        panose-1:3 15 7 2 3 3 2 2 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
p
        {margin-right:0in;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman";}
span.EmailStyle18
        {font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><!-- Converted from text/rtf format -->This
is what we put together. It will show the path.</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>The name is sr&nbsp; Within this directory
create links with the client names.</span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>&nbsp;</span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma'>-----Original Message-----<br>
<b><span style='font-weight:bold'>From:</span></b> veritas-bu-admin AT 
mailman.eng.auburn DOT edu
[mailto:veritas-bu-admin AT mailman.eng.auburn DOT edu] <b><span 
style='font-weight:
bold'>On Behalf Of </span></b>Marianne van den Berg<br>
<b><span style='font-weight:bold'>Sent:</span></b> Friday, September 23, 2005
7:27 AM<br>
<b><span style='font-weight:bold'>To:</span></b> NBUList (E-mail)<br>
<b><span style='font-weight:bold'>Subject:</span></b> [Veritas-bu] bplist &amp;
'-hoursago'</span></font></p>

<p class=MsoNormal style='margin-left:.5in'><font size=3 face="Times New 
Roman"><span
style='font-size:12.0pt'>&nbsp;</span></font></p>

<p style='margin-left:.5in'><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'>Hi</span></font> </p>

<p style='margin-left:.5in'><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'>I'm not a script writer. I need to run a bplist every
morning at 7 (will do this from cron) for each client to list all
files/directories backed up in the last 24 hours.</span></font></p>

<p style='margin-left:.5in'><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'>For some or other reason, not all NetBackup commands
have the same options - bplist does not have a '-hoursago', just a start and
end date.</span></font></p>

<p style='margin-left:.5in'><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'>Does anybody have a korn or bourne shell script that
can do this?</span></font> </p>

<p style='margin-left:.5in'><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'>THANKS!!</span></font> </p>

<p style='margin-left:.5in'><b><font size=2 face="Comic Sans MS"><span
style='font-size:10.0pt;font-family:"Comic Sans MS";font-weight:bold'>Marianne
van den Berg</span></font></b> </p>

</div>

</body>

</html>

------_=_NextPart_001_01C5C035.45F642F6--

------_=_NextPart_000_01C5C035.45F642F6
Content-Type: application/octet-stream;
        name="sr"
Content-Disposition: attachment;
        filename="sr"

#!/bin/ksh 

# How many days --  The default is one.
days=$1  
days=${days:=1}
let hago=24*$days

rm /tmp/burer
exec 2>/tmp/burer

clname=`basename $0`bk  # client name is the script name plus bk
TR=/usr/bin/tr
TAB=`/bin/echo ' ' | $TR ' ' '\011'`
echo " "
echo " "
echo ">>>> Jobs for "$clname":  For the last "$hago" hours "
echo ">>>> Current date is "`date`
echo " "
echo "JOBID${TAB} DATE${TAB}${TAB}TIME ${TAB} STATE${TAB}      STATUS    
MEDIAID${TAB} PATH"
echo 
'==================================================================================='

joblist=`bperror -client $clname -hoursago $hago   | grep jobid|nawk '{print 
$6}'` 

for i in $joblist; do
   
#####################################################
# # Get the path and file for this job
#####################################################
  bperror -jobid $i -hoursago $hago|grep handlin > /dev/null
  retc=$?
  if (($retc==0)) then
    bupath=`bperror -jobid $i -hoursago $hago |grep handling|nawk '{print $15}'`

    ### If more than one file show the last one only and the + sign
    wrds=`echo $bupath | wc -w` #more then one file ??
    if (( $wrds > 1 )) then      #cut it down to one and add plus sign
      bupath=+`echo $bupath | cut -d' ' -f$wrds`
    fi

    ###Trim the name when necessary 
    plen=${#bupath}
    if (($plen>17)); then
      plus="+"
      let startpos=$plen-16
      bupath=`echo $bupath|nawk '{print substr($1,'$startpos',17)}'`
      bupath=`echo $plus$bupath`
    fi
  else
    bupath='Unknown'
  fi

#####################################################
# # Get the time the job started        
#####################################################
  butime=`bperror -U -jobid $i -hoursago $hago | grep added|nawk '{print  $1"  
" $2}'`

#####################################################
# # Get the job state if the job db hasn't been cleared !!
#####################################################
  bustate=`bpdbjobs | grep ^$i| nawk '{print $3}'`
  bustate=${bustate:=Unknown}
  # # Adjust the state length
  if [ "${bustate}" = "Done" ] ; then bustate='Done   ';fi
  if [ "${bustate}" = "Active" ] ; then bustate='Active ';fi 

#####################################################
# # Get the status (return code) for the job              
#####################################################
  bperror  -jobid $i -hoursago $hago | grep STATUS| grep SCHED > /dev/null
  retc=$?
  if (($retc==0)) then  
    bpstatus=`bperror  -jobid $i -hoursago $hago | grep STATUS|nawk '{print 
$19}'|tail -1`
  else
    bpstatus='unknown'
  fi

#####################################################
# # Get the media used for the job
#####################################################
  bperror -jobid $i -hoursago $hago |grep fragment|grep media > /dev/null
  retc=$?
  if (($retc==0)) then
    bumedia=`bperror -jobid $i -hoursago $hago |grep fragment|grep media|nawk 
'{print $23}'`
    wrds=`echo $bumedia | wc -w` #more then one tape
    if (( $wrds > 1 )) then      #cut it down to one and add plus sign
      bumedia=+`echo $bumedia | cut -b2-6`
    fi
  else
    bumedia='******'
  fi


#####################################################
# # Punch out the job record                              
#####################################################
  echo "$i${TAB} $butime${TAB} $bustate${TAB} $bpstatus${TAB} $bumedia${TAB} 
$bupath"
done

echo " "
echo " "

echo `cat /tmp/burer | wc -l` errors in /tmp/burer
exit

------_=_NextPart_000_01C5C035.45F642F6--

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