multiple clients updating same file in ftp

Mike Meyer mwm at mired.org
Thu Jan 5 22:42:10 CET 2006


"stewart.midwinter at gmail.com" <stewart.midwinter at gmail.com> writes:
> here's a simple-minded suggestion: have the first client create a text
> file on the remote server, and delete it when it is finished updating.
> The second client can check for existence of this file before trying to
> update. 

That's an old hack, dating back to at least Unix v6. The problem is
the window between "check for lock file" and "create lock file." The
solution is to use an atomic create-or-fail action for the lock
file. Exatly what that is will depend on your server, but things to
check on are rename and mkdir.

      <mike
-- 
Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.



More information about the Python-list mailing list