Keenan, Greg John (Greg)** CTR ** wrote:
> 
> There is a solution, "Trailing a Growing File", in the Perl Cookbook that I
> have used before that may solve your problem.
> 
> I ran my script from inittab so it respawned if it died and it checks any
> new data written to a log file.  If a certain string is found it did some
> processing.  I don't have my script anymore but this is the excert from the
> Cookbook:
> 
> $naptime = 1;
> use IO::Handle;
> open (LOGFILE, "/tmp/logfile") or die "can't open /tmp/logfile: $!";
> for (;;) {
>     while (<LOGFILE>) { check for your IP and do something }
>     sleep $naptime;
>     LOGFILE->clearerr();            # clear stdio error flag
> }

And if you don't have Perl Cookbook you can read the FAQ:

perldoc -q "tail -f"

Found in /usr/lib/perl5/5.8.6/pod/perlfaq5.pod
       How do I do a "tail -f" in perl?



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to