Checking for duplicate instances of a script...

William Park opengeometry at yahoo.ca
Wed Jan 21 23:51:41 CET 2004


Guillaume Dargaud <NOusenetSPAM at gdargaud.net> wrote:
> Hello, python beginner here,
> How can I make sure that a given script is never run more than once at the
> same time in a system ?
> Besides checking 'ps' for its own name. Most modern langages have a direct
> way to do that.

1. Check 'ps'.  But, if 2 processes checks at the same, then they see
nothing is running and decides to run themselves.

2. Use lockfile.  

-- 
William Park, Open Geometry Consulting, <opengeometry at yahoo.ca>
Linux solution for data management and processing. 



More information about the Python-list mailing list