avoid script running twice

Evan Klitzke evan at yelp.com
Mon Jun 18 20:55:45 CEST 2007


On 6/18/07, Robin Becker <robin at reportlab.com> wrote:
> Evan Klitzke wrote:
> ........
>
> >
> > Another method that you can use is to open up a socket on some
> > predetermined port (presumably above 1024), and then have your program
> > try to connect to that port and "talk" to the other program to
> > determine whether or not to run (or whether to do some of the
> > remaining work, etc.).
> >
>
> that might work, but this runs on  someone's java solaris box with possible many
> connections going on. I doubt I'd be able to guarantee a particular port.
> --
> Robin Becker

If you can run long-lived processes, you can write a small daemon that
runs on a particular port forever and use that to establish a port
that the other scripts can use. Of course now the solution is getting
a bit more complicated than you probably want...

-- 
Evan Klitzke <evan at yelp.com>



More information about the Python-list mailing list