I am not sure if this is the right place to ask this but I was hoping
someone hashad a similer problem.

Here is my issue, I am running perl on NT and have written a very simple
script to read a log file and parse through to find words.

If I run the script from the CMD prompt, there are no errors and it works
fine. The issue is if I try to run, it from the windows scheduler it fails.
The reason I am thinking it may be related to my script is that I have other
scripts that are similar that run just fine.  It really is bizarre.

Here is my script.  As you will see there is nothing that should caus this
to happen.  Many of you have seen this before.
#/usr/bin/perl

$cmd = '..\\..\\srvrmgr /g apollo.ts.checkpoint.com /e CHK_ENT_PRD /s
CHK_SBL_PRD /u xxxxxx /p xxxxxx /c "list tasks for server CHK_SBL_PRD
component Email Manager" > ..\\..\\emailmgr.txt';
$result = `$cmd`;                       # note back-ticks

#open a file with the filehandle
open EMAILMGR, "+<..\\..\\emailmgr.txt"  or die "Cannot open email manager
$!\n";

#my $data = <EMAILMGR> for (1..22);      #Testing to make sure I am
#grabbing the correct data----
for(my $i=0; $i<22; $i++){<EMAILMGR>};   #This will put you at row 23.----
  $_=<EMAILMGR>;
  my $line=$_;
  my $found=0;
  my $target = 'Sleeping for 10';


if (substr($line, 106, 15) eq "Sleeping for 10")
{

  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;

}
else
{
        print "Successfully Completed Email Manager Working\n";
        print  substr($line, 106, 21);
}

Thanks
Lance


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

Reply via email to