Can some one please look at my code ad see what I am doing wrong. For some reason it is not working when there is less then three running. if you look at the log file it is reading you will see that only 2 are running and it did not send an email.
CHK_SBL_PRD WorkMon 97015 409 Running Background 04/05/2002 CHK_SBL_PRD WorkMon 91757 457 Running Background 04/05/2002 CHK_SBL_PRD WorkMon 27241 Completed Background 04/04/2002 CHK_SBL_PRD WorkMon 27240 Completed Background 04/04/2002 CHK_SBL_PRD WorkMon 27239 Exited with error Background 04/04/2002 5 rows returned. Thank you again. Lance #open a file with the filehandle open WORKFLOW, "+<..\\..\\workflow.txt" or die "Cannot open Workflow $!\n"; $counting_runners = 0; while (<INFILE>){ if ($_=~m/running/i){ $counting_runners++; use Mail::Sendmail; #Send and email if there are errors %mail = ( To => '[EMAIL PROTECTED]', From => '[EMAIL PROTECTED]', Subject => '', Message => 'Work Flow ended: '.substr($line, 95, 17) ); sendmail(%mail) or die $Mail::Sendmail::error; print "OK. Log says:\n", $Mail::Sendmail::log; } if ($counting_runners == 3) { open (APPEND, ">>Moniterlog.log") or die "$! error trying to append"; ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time); %weekday=( "0"=>"Sunday", "1"=>"Monday", "2"=>"Tueday", "3"=>"Wednesday", "4"=>"Thursday", "5"=>"Friday", "6"=>"Saturday", "7"=>"Sunday", ); if ($hour> 12) { print APPEND "Successfully Completed Work Flow Moniter $hour:$min\n"; print APPEND 'Substring: '.substr($_, 42, 7); print APPEND "\n"; print APPEND 'Substring: '.substr($nextline, 42, 7); print APPEND "\n"; print APPEND "----------------------------------------------------\n"; } else { print APPEND "Successfully Completed Work Flow Moniter $hour:$min\n"; print APPEND 'Substring: '.substr($_, 42, 7); print APPEND "\n"; print APPEND 'Substring: '.substr($nextline, 42, 7); print APPEND "\n"; print APPEND "----------------------------------------------------\n"; } last; } } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]