Making sure script only runs once instance at a time.

Paul Rubin http
Fri Sep 29 13:29:36 EDT 2006


Fredrik Lundh <fredrik at pythonware.com> writes:
> opening a file for writing doesn't lock it on Unix.  if you want
> locking, you need other mechanisms, and I'm not sure any of them
> work properly on all configurations, under all circumstances.

Hmm.  What about trying to listen on a PF_UNIX socket associated with
the lock file name.  If another process has the socket bound, you get
EISCONN.  But if the other process exists, maybe there's a delay
before another process can have it, like there is for TCP (I haven't
tested, or at least I don't remember the result).



More information about the Python-list mailing list