On Wed, 2009-08-19 at 15:55 +0800, Dengxule wrote:
> Hi everyone:
> 
> I have a crontab command to execuate my php-script every half an hour.
> 
> The mission of the php-script is to open a file(log file), examine it.
> 
> The target file(log file) is transported to local every half an hour.
> 
> I've no idea how much time it will costs and on the other hand, i want to
> make sure the file i'm openning is Completely Written.
> 
> Any instruction will be grateful.
> 
> 
> PS: I've made a test. My php-script just "fopen" a local file being
> transported in, and the "fopen" returns no FALSE value but a resource.
> 
> 
> Dengxule
> 2009/08/19

I had to do something similar in my last job. First thing to do is
figure out how large the log you expect to parse is going to be, and
from there, have a guess at how long it will take to transfer fully from
elsewhere.

I'd make the cron script a bit more frequent, but only ask it to look
for files that have changed between x and y minutes ago, where y is a
minute or two over the transfer duration. Then you can either mark the
file in some way, or move it to another location to indicate it has been
processed.

Thanks,
Ash
http://www.ashleysheridan.co.uk




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to