Veritas-bu

[Veritas-bu] list media by last written date

2003-01-25 16:14:26
Subject: [Veritas-bu] list media by last written date
From: trosamond AT uslec DOT com (Rosamond, Travis)
Date: Sat, 25 Jan 2003 16:14:26 -0500
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_01C2C4B6.BD63371F
Content-Type: text/plain;
        charset="iso-8859-1"

 H ere is a perl script I asked our perl guy to write to do what you/we are
requesting...  We use it for our weekly rotations.

 
Hope this is helpful... Explanation at the bottom..
 
#!/usr/bin/perl -w
 


use strict;
 

##################
# Global Vars
##################
my ($Sdate, $Stime, $Edate, $Etime);
my $argcount = $#ARGV + 1;
my $command = '/usr/openv/netbackup/bin/admincmd/bpimagelist -A -media ';
my $outfile = '/tmp/list-bpimagelist';
 
##################
# Eval Command line
##################
if ( ($argcount > 5) or (($argcount > 0) and ($argcount < 4)))
{
    print "Only 4 arguments are accepted\n";
    print "<Start Date> <Start Time> <End Date> <End Time>\n";
}
elsif ($argcount == 4)
{
    chomp $ARGV[0];
    chomp $ARGV[1];
    chomp $ARGV[2];
    chomp $ARGV[3];
 
    $Sdate = $ARGV[0];
    $Stime = $ARGV[1];
    $Edate = $ARGV[2];
    $Etime = $ARGV[3];
 
    exit if (! check_date($Sdate));
    exit if (! check_time($Stime));
    exit if (! check_date($Edate));
    exit if (! check_time($Etime));
    execute_command($Sdate, $Stime, $Edate, $Etime);
    exit;
}
 

##################
# Main
##################
prompt_user();
if (display_entered())
{
    execute_command($Sdate, $Stime, $Edate, $Etime);
}
else
{
       print "Exiting\n";
}
 
##################
# Subs
##################
 
sub execute_command
{
    my $local_Sdate = shift;
    my $local_Stime = shift;
    my $local_Edate = shift;
    my $local_Etime = shift;
    my $local_command = $command.' -d '.$local_Sdate.' '.$local_Stime.':00
-e '.$local_Edate.' '.$local_Etime.':00'.' > '.$outfile;
 
    print "Executing $local_command\n";
    system($local_command);
}
 
sub prompt_user
{
    while (1)
    {
       print "Enter start date (mm/dd/yy): ";
        $Sdate = <>;
        chomp($Sdate);
        last if (check_date($Sdate));
    }
 
    while (1)
    {
    print "Enter start time (hh:mm): ";
      $Stime = <>;
      chomp($Stime);
      last if (check_time($Stime));
    }
 
    while (1)
    {
    print "Enter end date (mm/dd/yy): ";
      $Edate = <>;
      chomp($Edate);
      last if (check_date($Edate));
    }
 
    while (1)
    {
    print "Enter end time (hh:mm): ";
      $Etime = <>;
      chomp($Etime);
      last if (check_time($Etime));
    }
 
}
 

sub display_entered
{
    my $RETURN = 0;
    print "\n";
    print "You Entered:\n";
    print "Start Date:  $Sdate\n";
    print "Start Time:  $Stime\n";
    print "End Date:    $Edate\n";
    print "End Time:    $Etime\n";
    print "\nExecute with these dates/times [Yy/Nn]: ";
    my $ans = <>;
    chomp($ans);
 
    $RETURN = 1 if (($ans eq ('Y'|'y')));
 
    return $RETURN;
}
 

sub check_time
{
    my $RETURN = 1;
    my $time = shift;
    my ($hours, $minutes);
    #if (not($time =~ m/^(\d|\d\d)\:\d\d$/))
    if (not($time =~ m/^\d\d\:\d\d$/))
    {
        print "Time must be in HH:MM\n";
        $RETURN = 0;
        return $RETURN;
    }
 
    ($hours, $minutes) = split(":",$time);
 
    if ( ($hours > 23) or ($hours < 0) )
    {
        print "Hours must be between 00 and 23\n";
        $RETURN = 0;
    }
 
    if ( ($minutes > 59) or ($minutes < 0) )
    {
        print "Minutes must be between 00 and 59\n";
        $RETURN = 0;
    }
 
    return $RETURN;
}
 

sub check_date
{
    my %calendar = (
         1        => 31,
         2        => 28,
         3        => 31,
         4        => 30,
         5        => 31,
         6        => 30,
         7        => 31,
         8        => 31,
         9        => 30,
         10       => 31,
         11       => 30,
         12       => 31,);
 
    my $RETURN = 1;
    my $date = shift;
    my ($day, $month, $year);
    
    #if (not ($date =~ m/^(\d|\d\d)\/(\d|\d\d)\/\d\d$/))
    if (not ($date =~ m/^\d\d\/\d\d\/\d\d$/))
    {
        print "Date must be in MM/DD/YY\n";
        $RETURN = 0;
        return $RETURN;
    }
    
    ($month, $day, $year) = split("/",$date);
    my $YYYY = '20'.$year;
    if (! $YYYY % 4) {$calendar{2} = '29'}; #leap year
 
    $month =~ s/^0//;
    $day   =~ s/^0//;
 
    if (( $month > 12 ) or ($month < 1))
    {
        print "Month must be between 01 and 12\n";
        $RETURN = 0;
        return $RETURN;
    }
 
    if (( $day > $calendar{$month}) or ($day < 1))
    {
        print "Dates for month \'$month\' must be between ",
              "1 and $calendar{$month}\n";
        $RETURN = 0;
        return $RETURN;
    }
    return $RETURN;
}

 
-----Original Message-----




 It has two modes of operation, command line and interactive.

Command line format is:
./nb.pl <Start Date> <Start Time> <End Date> <End Time>

executed as:
./nb.pl  01/20/03 06:00 01/22/03 23:59

Notice that the time you enter does not have the seconds, it is only HH:MM,
the seconds are appended as :00 to the input.

To use it in automatic mode just type ./nb.pl and you are prompted through
all the required information.   A couple notes though, the time is checked
to make sure that the hours are valid and the minutes are valid and the date
is checked to make sure a valid month is entered and a valid number of days
for that month.  For example, you cannot say 02/30/03 it will give an
informational error and prompt for  the same info until the user gets it
right or <CTR>C is pressed.

What it does not check is the dates against each other.  It does not make
sure that the '-d' date or tim is earlier than the '-e' date or time.  Also,
the year is only checked to make sure it is two digits.  The value of the
year you enter is not checked at all.  Also the year is hardcoded with a
'20' prefix.  If you need this changed let me know.


------_=_NextPart_001_01C2C4B6.BD63371F
Content-Type: text/html;
        charset="iso-8859-1"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE></TITLE>

<META content="MSHTML 6.00.2800.1126" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=098473114-25012003><FONT color=#0000ff><SPAN 
class=200331221-25012003>&nbsp;H&nbsp;</SPAN>ere is a perl script I asked our 
perl guy to write to do what you/we are requesting...&nbsp; We use it for our 
weekly rotations.</FONT></SPAN></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
  <BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
    <DIV><SPAN class=098473114-25012003><FONT 
    color=#0000ff></FONT></SPAN>&nbsp;</DIV>
    <DIV><SPAN class=098473114-25012003><FONT color=#0000ff>Hope this is 
    helpful...<SPAN class=200331221-25012003>&nbsp;Explanation at the 
    bottom..</SPAN></FONT></SPAN></DIV>
    <DIV><SPAN class=098473114-25012003><FONT color=#0000ff><SPAN 
    class=200331221-25012003></SPAN></FONT></SPAN>&nbsp;</DIV>
    <DIV><SPAN class=098473114-25012003><FONT color=#0000ff><SPAN 
    class=200331221-25012003>#!/usr/bin/perl -w</SPAN></FONT></SPAN></DIV>
    <DIV>&nbsp;</DIV><SPAN class=098473114-25012003><FONT color=#0000ff><SPAN 
    class=200331221-25012003>
    <DIV><BR>use strict;</DIV>
    <DIV>&nbsp;</DIV>
    <DIV><BR>##################<BR># Global Vars<BR>##################<BR>my 
    ($Sdate, $Stime, $Edate, $Etime);<BR>my $argcount = $#ARGV + 1;<BR>my 
    $command = '/usr/openv/netbackup/bin/admincmd/bpimagelist -A -media 
';<BR>my 
    $outfile = '/tmp/list-bpimagelist';</DIV>
    <DIV>&nbsp;</DIV>
    <DIV>##################<BR># Eval Command line<BR>##################<BR>if 
( 
    ($argcount &gt; 5) or (($argcount &gt; 0) and ($argcount &lt; 
    4)))<BR>{<BR>&nbsp;&nbsp;&nbsp; print "Only 4 arguments are 
    accepted\n";<BR>&nbsp;&nbsp;&nbsp; print "&lt;Start Date&gt; &lt;Start 
    Time&gt; &lt;End Date&gt; &lt;End Time&gt;\n";<BR>}<BR>elsif ($argcount == 
    4)<BR>{<BR>&nbsp;&nbsp;&nbsp; chomp $ARGV[0];<BR>&nbsp;&nbsp;&nbsp; chomp 
    $ARGV[1];<BR>&nbsp;&nbsp;&nbsp; chomp $ARGV[2];<BR>&nbsp;&nbsp;&nbsp; chomp 
    $ARGV[3];</DIV>
    <DIV>&nbsp;</DIV>
    <DIV>&nbsp;&nbsp;&nbsp; $Sdate = $ARGV[0];<BR>&nbsp;&nbsp;&nbsp; $Stime = 
    $ARGV[1];<BR>&nbsp;&nbsp;&nbsp; $Edate = $ARGV[2];<BR>&nbsp;&nbsp;&nbsp; 
    $Etime = $ARGV[3];</DIV>
    <DIV>&nbsp;</DIV>
    <DIV>&nbsp;&nbsp;&nbsp; exit if (! 
    check_date($Sdate));<BR>&nbsp;&nbsp;&nbsp; exit if (! 
    check_time($Stime));<BR>&nbsp;&nbsp;&nbsp; exit if (! 
    check_date($Edate));<BR>&nbsp;&nbsp;&nbsp; exit if (! 
    check_time($Etime));<BR>&nbsp;&nbsp;&nbsp; execute_command($Sdate, $Stime, 
    $Edate, $Etime);<BR>&nbsp;&nbsp;&nbsp; exit;<BR>}</DIV>
    <DIV>&nbsp;</DIV>
    <DIV><BR>##################<BR># 
    Main<BR>##################<BR>prompt_user();<BR>if 
    (display_entered())<BR>{<BR>&nbsp;&nbsp;&nbsp; execute_command($Sdate, 
    $Stime, $Edate, 
    $Etime);<BR>}<BR>else<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print 
    "Exiting\n";<BR>}</DIV>
    <DIV>&nbsp;</DIV>
    <DIV>##################<BR># Subs<BR>##################</DIV>
    <DIV>&nbsp;</DIV>
    <DIV>sub execute_command<BR>{<BR>&nbsp;&nbsp;&nbsp; my $local_Sdate = 
    shift;<BR>&nbsp;&nbsp;&nbsp; my $local_Stime = shift;<BR>&nbsp;&nbsp;&nbsp; 
    my $local_Edate = shift;<BR>&nbsp;&nbsp;&nbsp; my $local_Etime = 
    shift;<BR>&nbsp;&nbsp;&nbsp; my $local_command = $command.' -d 
    '.$local_Sdate.' '.$local_Stime.':00 -e '.$local_Edate.' 
    '.$local_Etime.':00'.' &gt; '.$outfile;</DIV>
    <DIV>&nbsp;</DIV>
    <DIV>&nbsp;&nbsp;&nbsp; print "Executing 
    $local_command\n";<BR>&nbsp;&nbsp;&nbsp; system($local_command);<BR>}</DIV>
    <DIV>&nbsp;</DIV>
    <DIV>sub prompt_user<BR>{<BR>&nbsp;&nbsp;&nbsp; while 
    (1)<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print 
    "Enter start date (mm/dd/yy): 
    ";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $Sdate = 
    &lt;&gt;;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    chomp($Sdate);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; last if 
    (check_date($Sdate));<BR>&nbsp;&nbsp;&nbsp; }</DIV>
    <DIV>&nbsp;</DIV>
    <DIV>&nbsp;&nbsp;&nbsp; while (1)<BR>&nbsp;&nbsp;&nbsp; 
    {<BR>&nbsp;&nbsp;&nbsp; print "Enter start time (hh:mm): 
    ";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $Stime = 
    &lt;&gt;;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    chomp($Stime);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; last if 
    (check_time($Stime));<BR>&nbsp;&nbsp;&nbsp; }</DIV>
    <DIV>&nbsp;</DIV>
    <DIV>&nbsp;&nbsp;&nbsp; while (1)<BR>&nbsp;&nbsp;&nbsp; 
    {<BR>&nbsp;&nbsp;&nbsp; print "Enter end date (mm/dd/yy): 
    ";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $Edate = 
    &lt;&gt;;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    chomp($Edate);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; last if 
    (check_date($Edate));<BR>&nbsp;&nbsp;&nbsp; }</DIV>
    <DIV>&nbsp;</DIV>
    <DIV>&nbsp;&nbsp;&nbsp; while (1)<BR>&nbsp;&nbsp;&nbsp; 
    {<BR>&nbsp;&nbsp;&nbsp; print "Enter end time (hh:mm): 
    ";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $Etime = 
    &lt;&gt;;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    chomp($Etime);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; last if 
    (check_time($Etime));<BR>&nbsp;&nbsp;&nbsp; }</DIV>
    <DIV>&nbsp;</DIV>
    <DIV>}</DIV>
    <DIV>&nbsp;</DIV>
    <DIV><BR>sub display_entered<BR>{<BR>&nbsp;&nbsp;&nbsp; my $RETURN = 
    0;<BR>&nbsp;&nbsp;&nbsp; print "\n";<BR>&nbsp;&nbsp;&nbsp; print "You 
    Entered:\n";<BR>&nbsp;&nbsp;&nbsp; print "Start Date:&nbsp; 
    $Sdate\n";<BR>&nbsp;&nbsp;&nbsp; print "Start Time:&nbsp; 
    $Stime\n";<BR>&nbsp;&nbsp;&nbsp; print "End Date:&nbsp;&nbsp;&nbsp; 
    $Edate\n";<BR>&nbsp;&nbsp;&nbsp; print "End Time:&nbsp;&nbsp;&nbsp; 
    $Etime\n";<BR>&nbsp;&nbsp;&nbsp; print "\nExecute with these dates/times 
    [Yy/Nn]: ";<BR>&nbsp;&nbsp;&nbsp; my $ans = &lt;&gt;;<BR>&nbsp;&nbsp;&nbsp; 
    chomp($ans);</DIV>
    <DIV>&nbsp;</DIV>
    <DIV>&nbsp;&nbsp;&nbsp; $RETURN = 1 if (($ans eq ('Y'|'y')));</DIV>
    <DIV>&nbsp;</DIV>
    <DIV>&nbsp;&nbsp;&nbsp; return $RETURN;<BR>}</DIV>
    <DIV>&nbsp;</DIV>
    <DIV><BR>sub check_time<BR>{<BR>&nbsp;&nbsp;&nbsp; my $RETURN = 
    1;<BR>&nbsp;&nbsp;&nbsp; my $time = shift;<BR>&nbsp;&nbsp;&nbsp; my 
($hours, 
    $minutes);<BR>&nbsp;&nbsp;&nbsp; #if (not($time =~ 
    m/^(\d|\d\d)\:\d\d$/))<BR>&nbsp;&nbsp;&nbsp; if (not($time =~ 
    m/^\d\d\:\d\d$/))<BR>&nbsp;&nbsp;&nbsp; 
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print "Time must be in 
    HH:MM\n";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $RETURN = 
    0;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 
    $RETURN;<BR>&nbsp;&nbsp;&nbsp; }</DIV>
    <DIV>&nbsp;</DIV>
    <DIV>&nbsp;&nbsp;&nbsp; ($hours, $minutes) = split(":",$time);</DIV>
    <DIV>&nbsp;</DIV>
    <DIV>&nbsp;&nbsp;&nbsp; if ( ($hours &gt; 23) or ($hours &lt; 0) 
    )<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    print "Hours must be between 00 and 
    23\n";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $RETURN = 
    0;<BR>&nbsp;&nbsp;&nbsp; }</DIV>
    <DIV>&nbsp;</DIV>
    <DIV>&nbsp;&nbsp;&nbsp; if ( ($minutes &gt; 59) or ($minutes &lt; 0) 
    )<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    print "Minutes must be between 00 and 
    59\n";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $RETURN = 
    0;<BR>&nbsp;&nbsp;&nbsp; }</DIV>
    <DIV>&nbsp;</DIV>
    <DIV>&nbsp;&nbsp;&nbsp; return $RETURN;<BR>}</DIV>
    <DIV>&nbsp;</DIV>
    <DIV><BR>sub check_date<BR>{<BR>&nbsp;&nbsp;&nbsp; my %calendar = 
    (<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =&gt; 
    31,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =&gt; 
    28,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =&gt; 
    31,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =&gt; 
    30,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    5&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =&gt; 
    31,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =&gt; 
    30,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    7&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =&gt; 
    31,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =&gt; 
    31,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    9&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =&gt; 
    30,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    10&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =&gt; 
    31,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    11&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =&gt; 
    30,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    12&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =&gt; 31,);</DIV>
    <DIV>&nbsp;</DIV>
    <DIV>&nbsp;&nbsp;&nbsp; my $RETURN = 1;<BR>&nbsp;&nbsp;&nbsp; my $date = 
    shift;<BR>&nbsp;&nbsp;&nbsp; my ($day, $month, 
$year);<BR>&nbsp;&nbsp;&nbsp; 
    <BR>&nbsp;&nbsp;&nbsp; #if (not ($date =~ 
    m/^(\d|\d\d)\/(\d|\d\d)\/\d\d$/))<BR>&nbsp;&nbsp;&nbsp; if (not ($date =~ 
    m/^\d\d\/\d\d\/\d\d$/))<BR>&nbsp;&nbsp;&nbsp; 
    {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print "Date must be in 
    MM/DD/YY\n";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $RETURN = 
    0;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 
    $RETURN;<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; 
    <BR>&nbsp;&nbsp;&nbsp; ($month, $day, $year) = 
    split("/",$date);<BR>&nbsp;&nbsp;&nbsp; my $YYYY = 
    '20'.$year;<BR>&nbsp;&nbsp;&nbsp; if (! $YYYY % 4) {$calendar{2} = '29'}; 
    #leap year</DIV>
    <DIV>&nbsp;</DIV>
    <DIV>&nbsp;&nbsp;&nbsp; $month =~ s/^0//;<BR>&nbsp;&nbsp;&nbsp; 
    $day&nbsp;&nbsp; =~ s/^0//;</DIV>
    <DIV>&nbsp;</DIV>
    <DIV>&nbsp;&nbsp;&nbsp; if (( $month &gt; 12 ) or ($month &lt; 
    1))<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    print "Month must be between 01 and 
    12\n";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $RETURN = 
    0;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 
    $RETURN;<BR>&nbsp;&nbsp;&nbsp; }</DIV>
    <DIV>&nbsp;</DIV>
    <DIV>&nbsp;&nbsp;&nbsp; if (( $day &gt; $calendar{$month}) or ($day &lt; 
    1))<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    print "Dates for month \'$month\' must be between 
    
",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 
    "1 and $calendar{$month}\n";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    $RETURN = 0;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 
    $RETURN;<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; return 
    $RETURN;<BR>}<BR><BR>&nbsp;</SPAN></FONT></SPAN></DIV>
    <DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma 
    size=2>-----Original Message-----<BR><BR></FONT></DIV>
    <P><FONT size=2><BR>&nbsp;It has two modes of operation, command line and 
    interactive.<BR><BR>Command line format is:<BR><FONT color=#0000ff>./nb.pl 
    &lt;Start Date&gt; &lt;Start Time&gt; &lt;End Date&gt; &lt;End 
    Time&gt;</FONT><BR><BR>executed as:<BR><FONT color=#0000ff>./nb.pl&nbsp; 
    01/20/03 06:00 01/22/03 23:59</FONT></FONT></P>
    <P><FONT size=2>Notice that the time you enter does not have the seconds, 
it 
    is only HH:MM, the seconds are appended as :00 to the input.</FONT></P>
    <P><FONT size=2>To use it in automatic mode just type ./nb.pl and you are 
    prompted through all the required information.&nbsp;&nbsp; A couple notes 
    though, the time is checked to make sure that the hours are valid and the 
    minutes are valid and the date is checked to make sure a valid month is 
    entered and a valid number of days for that month.&nbsp; For example, you 
    cannot say 02/30/03 it will give an informational error and prompt 
for&nbsp; 
    the same info until the user gets it right or &lt;CTR&gt;C is 
    pressed.</FONT></P>
    <P><FONT size=2>What it does not check is the dates against each 
    other.&nbsp; It does not make sure that the '-d' date or tim&nbsp;is 
earlier 
    than the '-e' date or time.&nbsp; Also, the year is only checked to make 
    sure it is two digits.&nbsp; The value of the year you enter is not checked 
    at all.&nbsp; Also the year is hardcoded with a '20' prefix.&nbsp; If you 
    need this changed let me 
know.</FONT></P></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>

------_=_NextPart_001_01C2C4B6.BD63371F--

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