Ensure only single application instance.

Frank Millman frank at chagford.com
Sat Aug 30 07:25:28 CEST 2008


On Aug 29, 11:25 pm, Uberman <bhoo... at hotmail.com> wrote:
> On Fri, Aug 29, 2008 at 6:51 AM, Heston James <heston_ja... at live.co.uk> wrote:
> > Good afternoon all.
>
> > I have an application/script which is launched by crontab on a regular
> > basis. I need an effective and accurate way to ensure that only one instance
> > of the script is running at any one time.
>

The following is taken from the getmail FAQ -

------------------------------------------
If you need to prevent two instances of getmail from running
simultaneously, use any standard Unix method of providing a mutex for
this purpose. One example would be to run getmail under a program like
setlock (part of the daemontools package). Change your script or
crontab file to invoke getmail like this:

/path/to/setlock -n /path/to/lockfile /path/to/getmail [getmail
options]

There are other programs that provide functionality similar to
setlock.
------------------------------------------

HTH

Frank Millman



More information about the Python-list mailing list