RE: [PHP] How to make sure that the target file to read is not under writing by others?

From: Date: Wed, 19 Aug 2009 09:55:06 +0000
Subject: RE: [PHP] How to make sure that the target file to read is not under writing by others?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-296957@lists.php.net to get a copy of this message
-----Original Message----- From: Dengxule [mailto:dengxule@gmail.com] Sent: 19 August 2009 09:56 AM To: Php Maillist Subject: [PHP] How to make sure that the target file to read is not under writing by others? 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 ---------------- Check the timestamp of the log file. Alternatively you can have a log control file that is updated by the program transferring the log file only when the transfer is completed, and work on that. Cheers Arno

« previous php.general (#296957) next »