Allowing only one instance of a script?

Cameron Laird claird at lairds.us
Thu Jun 23 14:08:02 EDT 2005


In article <11bljln726sohf6 at corp.supernews.com>,
Grant Edwards  <grante at visi.com> wrote:
			.
			.
			.
>You can also use a network port instead of a file.  Binding a
>socket to a port is an exclusive and atomic operation.  An
>advantage to the network port scheme is that the "lock"
>automatically goes away if the program dies.  A disadvantiage is
>that it can't contain information (date/time/PID) like a file
>can.
			.
			.
			.
While you write elsewhere in this thread, Grant, that 
pid-in-a-file is the "usual" way, I much prefer this
technique of opening a simple TCP/IP server.  While I
recognize the disadvantage you describe, I choose to
regard it as an opportunity--since I have launched the
server anyway, I simply have it report to me (that is,
any connecting client) all the information I might want
want.



More information about the Python-list mailing list