samba-users August 2010 archive
Main Archive Page > Month Archives  > samba-users archives
samba-users: Re: [Samba] Can Samba lock files until copy is comp

Re: [Samba] Can Samba lock files until copy is complete?

From: Whit Blauvelt <whit+samba_at_nospam>
Date: Sat Aug 21 2010 - 13:12:32 GMT
To: Michael Wood <esiotrot@gmail.com>

On Sat, Aug 21, 2010 at 02:17:08PM +0200, Michael Wood wrote:

> I think the simplest way to do this, if you have some control over the
> clients, is to get them to upload to a temporary name and rename to
> the real name once the upload has completed. Then get the process
> that looks for files to ignore the ones with the temporary names.

We'd though of that, but the staff is so used to drag-and-drop file
operations, and also needs to have the share open to see what other staff
has already put there. So if we had the share read-only and gave an icon to
drop the files on that runs a script ... but staff performs under time
pressure, and is set in their method.

> If you can't control the filenames, try using something like incron to
> process the files only when they have been closed. Or use lsof to
> check if samba still has the files open. I don't know how reliable
> that will be, but perhaps it's another heuristic to add to your "not
> changed size for a while" check.

incron? Don't know/can't find it. Good suggestion on lsof. If it turns out
that Samba doesn't do anything strange like close a file at an intermediate
state, then reopen and resume copying that might work perfectly.

Whit
-- To unsubscribe from this list go to the following URL and read the instructions: https://lists.samba.org/mailman/options/samba