Mmmm not entirely tested as I'm slicing this from similar job, but give it a try:
Code:
#!/usr/bin/perl
$logfile = "your_log_file.log";
open $log, '<', $logfile;
my $position;
while (1) {
while (my $line = <$log>) {
# Skip the line if it's being writen atm
last unless substr($line, -1) eq "\n";
# Do some stuff here
# When finished, save the postion for later
$position = tell $log;
}
# Sleep
sleep (300); # Sleep for 5 min
# Skip the lines we already parsed
seek $log, $position, 0;
}
The script will parse the file then save the current position and sleep for 300 sec (5 mins).
Hope this helps.
Cheers,
Boris
Facebook, Twitter and Google+ Auth for GLinks and GCommunity |
reCAPTCHA for GLinks |
Free GLinks Plugins