Making sure script only runs once instance at a time.

MaR Maria.Reinhammar at accalon.com
Fri Sep 29 13:59:41 CEST 2006


A very brutal but simple and effective method is to bind() to a socket
on localhost eg (127.0.0.1, 4711), listen() but never accept().
Any other process trying to to bind() on the same port will fail..
When the process dies, the port is released automatically, pending som
timedelay..

But this assumes you have an execution environment where this is
acceptable. A sysadmin may have objections ;o)




More information about the Python-list mailing list