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

Jarek Zgoda jzgoda at gazeta.usun.pl
Sun Dec 28 03:00:33 EST 2003


Miki Tebeka <miki.tebeka at zoran.com> 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
http://www.zgoda.biz/ JID:zgoda-a-chrome.pl http://zgoda.jogger.pl/




More information about the Python-list mailing list