How to determine if an instance of your program is already running?

Jarek Zgoda jzgoda at
Sun Dec 28 09:00:33 CET 2003

Miki Tebeka <miki.tebeka at> pisze:

> You can have your program create a known directory (which IIRC an
> atomic operation). When a new instance tries to create it, there will
> be an exception.
> Make sure that when you application is closing to remove this
> directory.

Traditional way is to create pidfile somewhere -- in user's home
directory, /var/run...

Jarek Zgoda
Unregistered Linux User #-1

More information about the Python-list mailing list