[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ale] [OT] how do I monitor the "weather" in my computer room



On 06/07/2013 01:48 AM, Alex Carver wrote:
>> D) Sometimes, if I happen to retrieve the file while it's being written,
>> I get an incomplete result.
> 
> This would be an expected flaw in the implementation with almost any web
> server.  You would have to create a temporary file first, then at the
> last moment copy the temporary file to the permanent location (since the
> copy will be fast versus the writing of several command outputs).  The
> only true way to avoid this is with CGI scripting to execute the script
> at time of request.

Short of CGI, the canonical way to handle this is to *rename* a
temporary file over the normal file.  The linux kernel will guarantee
that other processes will see either old or new in their entirety.

Phil