OS independent way to check if a python app is running?

MRAB python at mrabarnett.plus.com
Mon Dec 14 15:35:07 EST 2009


python at bdurham.com wrote:
> Is there an os independent way to check if a python app is running?
>  
> Goal: I have a server program based on cherrypy that I only want to have 
> running once. If a system administrator accidentally attempts to run 
> this program more than once, I would like the 2nd instance of the 
> program to detect that its already running and exit.
>  
You could use lockfile: http://pypi.python.org/pypi/lockfile/0.7

If a certain file exists and is locked, then the app is already running.



More information about the Python-list mailing list