OS independent way to check if a python app is running?
python at bdurham.com
python at bdurham.com
Tue Dec 15 02:52:51 EST 2009
Hi Dan,
> Maybe I'm missing something, but the locking mechanism already exists:
at some point, your server program has to bind to an IP port to listen
for incoming request, and any respectable OS won't let two programs bind
to the same port at the same time. So if binding to the input port
works, then there *can't* be another instance of the program running
(multiple configuration files notwithstanding, but then you'd need a
second process anyway).
We actually have a suite of server products which use ports in a
flexible way so your idea - although accurate - won't work in our
specific case.
MRAB and Diez posted some excellent, cross platform approaches to
locking a resource.
Thanks for your feedback.
Regards,
Malcolm
More information about the Python-list
mailing list