How do I force a single instance of a python app?

Joshua Muskovitz josh at open.com
Tue Oct 24 20:39:23 EDT 2000


A UDP listener (or an ICMP listener maybe) might work -- ICMP avoids the
one-listener-per-port restriction, but then they have to puzzle out which
one came first... :-)  This unfortunately won't work for me as I'm trying to
avoid sockets for reasons I won't go into.

The file hack, which writes a timestamp to the file is a very interesting
idea.  This could possibly be simplified to simply deleting and creating the
file and using the OS to find the file's timestamp, but this will probably
annoy NT which doesn't like lots of temp files, and tends to fragment
because of it.

A file which contained a timestamp and a pid will probably do the trick.  I
can live with the dead zone (the period of time between file updates) -- the
process doesn't have to restart immediately.  Also, I was reading in the FAQ
today that there is a way to trap when a python app is ending -- I can
delete the file at that point to reduce the dead zone delay when the app
behaves well.

Thanks for the suggestions!





-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----



More information about the Python-list mailing list