Hello Perl Gurus,
I need your help!
Here is the situation:
The following script searchs for a certain error in an
increasemental errorlog_file, and print out the
result.
Note that when the size of errolog_file grow into 5M
there is a process that prunes the errorlog_file,
makes its size become 0. Then the errorlog_file
continue to increase again.
The problem i'm facing is my seach_error.pl seems stop
to read the increasemental errorlog_file after it was
pruned.
My question are:
1. Is there a way to make search_error.pl continue to
read the errorlog_file after it was pruned without
restarting the script.
2. In the situation I have to restart the script (like
in case of machine have been bounced), I dont want the
script starts reading from the beginning of
errorlog_file, I want it skips to the line where it
stopped. How can I make this happens.
Thanks in advance for your input.
Loan Tran
-----------------------------
#!/usr/bin/perl
# usage: search_error.pl errorlog_file
open (FILE,"errorlog_file") || die "cannot open file
errorlog_file";
for(;;){
while(<FILE>){
if ($_ =~ /Error: 21||timeslice|Error: LOG
FULL|Error: SPACE|Error: from
dump|sddone:|udunmirror:|nopen: No virtual
sockets available|endpoints failed|timed out|THREAD
FATAL ERROR|is shutdown|operation terminated|Memory
Corruption Found/){
print "Serious! : $_ \n";
}#end if
}#end while
sleep 5;
seek(INPUT,0,1); # reset end-of-file error
}#end for
__________________________________________________
Do You Yahoo!?
LAUNCH - Your Yahoo! Music Experience
http://launch.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]