avoid script running twice
nick at craig-wood.com
Mon Jun 18 21:30:05 CEST 2007
Robin Becker <robin at reportlab.com> wrote:
> I looked at the temporary files idea, but I'm not certain about the exact
> details. Normally your create a file and then remove it whilst keeping the file
> handle; that allows your program to write to it whilst guaranteeing that it will
> vanish when you die, but this has to be a named file so that the second instance
> can check for it. Doesn't that prevent it from being already
> My unix experience is long, but fairly primitive.
Locking with files alone is racy..
You need flock under unix (this recipe shows windows flock equivalent also)
or use the directory idea I posted in another post.
Nick Craig-Wood <nick at craig-wood.com> -- http://www.craig-wood.com/nick
More information about the Python-list