SUMMARY: Exclusive Lock of File

From: Tom Sevy <tsevy_at_epx.com>
Date: Fri, 11 May 2001 11:32:12 -0400

Thank you to all who responded!

Original post at bottom.

Thanks to: Jim Fitsmaurice, Werner Rost, Lucio Chiappetti, and [Unknown]
System Administrator Account, Dr. Thomas Blinn, and J.A. Gutierrez

The suggestions included:

1 - A small file to be uploaded at the end of a successful upload of the
data file to indicate that we can proceed to take the data file
2 - Uploading using a temporary file name, and at the end of a successful
upload to rename the file to a file name that would be recognized as a
completed and successful upload
3 - There may be a way to modify the FTPD to create the file with 'sticky'
bits so that the locks are enforced.
4 - Loop over the files in the directory at an interval (say of 5
seconds), and when you see that the file size has remained constant, take
it.
5 - Look into lsof or fuser. If we are a source code licensee, we can
access this to see how it is done and perhaps include such functionality in
the perl script somehow


I should have been more specific. I don't have control of the clients, and
can't really add to their efforts by requesting that they either use a temp
name while uploading and rename it upon completion, or that they upload any
kind of indicator file such as a lock file or any other indication to let us
know when a file is done uploading.

I am leaning towards a variation of #4, but using stat to examine the last
modified time. When this reaches a given value (subtract this value from
time() for # of seconds since last modification to he file), then take it.

The files are usually from a Windows type platform (but not always), and
they are usually compressed (pkzip) and then encrypted. So I can't look at
content for a trailer record. If the file was a broken upload, then when
the file gets to its final destination (a Windows NT box), the unencrypt and
uncompress will fail. This part already works.






~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Original Post:

I am working on a perl script that will move files after they have been
uploaded via FTP.

I have found that while a file is still in the process of being uploaded, I
can move, rename, and even delete it. When we did this on NT, opening with
an exclusive lock was an effective way to make sure the file was done.
Doesn't seem to be the case with Perl & Tru64 5.1.

Any suggestions?
Received on Fri May 11 2001 - 15:33:17 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:42 NZDT