avoid script running twice

Robin Becker robin at reportlab.com
Mon Jun 18 19:22:52 CEST 2007

Wildemar Wildenburger wrote:
> Robin Becker wrote:
> Well I can think of a dumb way: create a temporary file during the 
> transaction and have your script check for that before running its main 
> body.
> I think thats the most hassle free way of doing it.
> /W
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 removed? My unix 
experience is long, but fairly primitive.
Robin Becker

More information about the Python-list mailing list