rebeccah2004
Programmer
Hello-
i am rather new to perl so the answer to my problem may be obvious. but i am writing a little perl script to back up a database, copy the dump to an offsite location, then email me the log when it is all done. i have it all working except when it emails me, it gets stuck in a loop and keeps emailing me the log until i kill it. any bit of help would be GREATLY appreciated. here is the code that is looping:
### batch script to email log when complete
my $filename = "tran.log";
my $found = 0;
open( FIN, "<$filename" );
while( <FIN> )
{
chomp;
if (substr($_,0,50) eq "$fatal"
{
$found = 1;
system("perl fatal_error.pl tran.log"
}
else {
system("perl customer.pl tran.log"
}
}
close ( FIN );
...what i would like it to do is search the log for the word "fatal", and if it see's it in there, then it runs a seperate perl script, but if "fatal" is not there it runs a different perl script.
any thoughts on what i am doing wrong?
thanks,
rebecca
i am rather new to perl so the answer to my problem may be obvious. but i am writing a little perl script to back up a database, copy the dump to an offsite location, then email me the log when it is all done. i have it all working except when it emails me, it gets stuck in a loop and keeps emailing me the log until i kill it. any bit of help would be GREATLY appreciated. here is the code that is looping:
### batch script to email log when complete
my $filename = "tran.log";
my $found = 0;
open( FIN, "<$filename" );
while( <FIN> )
{
chomp;
if (substr($_,0,50) eq "$fatal"
{
$found = 1;
system("perl fatal_error.pl tran.log"
}
else {
system("perl customer.pl tran.log"
}
}
close ( FIN );
...what i would like it to do is search the log for the word "fatal", and if it see's it in there, then it runs a seperate perl script, but if "fatal" is not there it runs a different perl script.
any thoughts on what i am doing wrong?
thanks,
rebecca