avoid script running twice
Tim Williams
tim at tdw.net
Mon Jun 18 13:18:55 EDT 2007
On 18/06/07, Wildemar Wildenburger <wildemar at freakmail.de> wrote:
> Robin Becker wrote:
> > I wish to prevent a python script from running twice; it's an hourly job, but
> > can take too long.
> >
> > [snip]
> > but it occurs to me that I might be killed with prejudice during the long
> > running work(). Is there a smart way to avoid running simultaneously.
> >
>
> Well I can think of a dumb way: create a temporary file during the
> transaction and have your script check for that before running its main
> body.
>
> I think thats the most hassle free way of doing it.
If the script finishes abnormally, the file will still exist and
future execution of the script will fail.
:)
--
Tim Williams
More information about the Python-list
mailing list