All,
I am experiencing the most bizarre problem with my perl script.  I am
running the below script on windows nt, that may be the root of the
problem..  The script reads a file and checks to see it the words "Sleeping
for 10 seconds" appears. If it appears four times in a row it sends a text
message so, we can correct the problem.

What seems to happen is after the script runs for about 2 months with out
restarting the box, at some point it starts reading "Sleeping for 1"    The
other thing I notice is when this occurs the output of looks different.

For example:

When it is working it looks like this
Sleeping for 10 seconds
Sleeping for 10 seconds
Sleeping for 10 seconds
Sleeping for 10 seconds
Send email

When it is not working it looks like this:
        Sleeping for 1
        Sleeping for 1
        Sleeping for 1
        Sleeping for 1
        END

As you notice there is a tb added to the script.. Anyone have an Idea to why
this occurring.

Below you will see the script

Thank you in advance for you help
Lance

  #!/usr/bin/perl



  my $count = 0;
  open MAIL_LOG, ">> siebel_mail.log" or
    die "can't append to siebl_mail.log: $!";
  # do this 7 times
  for (1 .. 7) {
    open OUTPUT, '..\\..\\srvrmgr /ser server.com /e CHK_ENT_PRD /s
CHK_SBL_PRD /u xxxxxx /p xxxxxxx /c "list tasks for server CHK_SBL_PRD
component Email Manager" |' or
      die "can't run srvrmgr: $!";
    <OUTPUT> for 1 .. 22;  # skip first 22 lines of output
    my $line = substr <OUTPUT>, 106, 22;
    close OUTPUT;
     ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time);
        if ($count eq  4)
        {

                use Mail::Sendmail;                    #Send and email if there are
errors
                %mail = ( To      =>  '[EMAIL PROTECTED]',
                From    =>  '[EMAIL PROTECTED]',
                Subject =>  '',
                Message =>   'Email Manager hung on Apollo'
                );
                sendmail(%mail) or die $Mail::Sendmail::error;
                print "OK. Log says:\n", $Mail::Sendmail::log;

        print "Apollo is stuck sent Email\n";
        if ($hour> 12)
        {
                print MAIL_LOG "Error Sending Email    ",$hour-12,":$min\n";
        }
        else
        {
                print MAIL_LOG "Error Sending Email    $hour:$min\n";
      }
        print  MAIL_LOG
"---------------------------------------------------------------------------
---- \n";
        close MAIL_LOG;
        exit;

        }
        else
        {
                if ($line eq "Sleeping for 10 second")
                {
                        $count++;
                        print "Count $count\n";
                        print MAIL_LOG $line, "\n";
                }
                else
                {

                        print $line, "\n";
                        print "Count $count\n";
                        print MAIL_LOG $line, "\n";
                }
    sleep 10;
        }
    }
        if ($hour> 12)
        {
                print MAIL_LOG "Completed    ",$hour-12,":$min\n";
        }
        else
        {
                print MAIL_LOG "Completed    $hour:$min\n";
        }
   print  MAIL_LOG
"---------------------------------------------------------------------------
---- \n";
  close MAIL_LOG;




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to