Path: csiph.com!usenet.pasdenom.info!goblin1!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: UNSURE 0.217 X-Spam-Level: ** X-Spam-Evidence: '*H*': 0.59; '*S*': 0.02; 'detect': 0.07; 'deploy': 0.09; 'subject:process': 0.09; 'runs': 0.10; 'second': 0.26; 'url:code': 0.29; 'message-id:@mail.gmail.com': 0.30; 'anyone': 0.31; 'run': 0.32; 'to:name:python-list': 0.33; "i'd": 0.34; 'could': 0.34; 'received:google.com': 0.35; 'url:org': 0.36; 'two': 0.37; 'to:addr:python-list': 0.38; 'launch': 0.39; 'to:addr:python.org': 0.39; 'users': 0.40; 'tell': 0.60; 'success': 0.61; 'first': 0.61; 'times': 0.62; 'day.': 0.63; 'happen': 0.63; 'url:p': 0.64; 'user,': 0.69; 'repeat.': 0.84; 'wanting': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=OaQiLkvMDEIWCcEuV/74LtQpfU5ntrtIr4h94viZXSg=; b=qYo4REuXTcyQfYTyqb5KB9rbWvqtxVWNSbRZbDXXKenTVy7HK+34Pn1ET165X92TFF YmgGIOY2R0D17cT4DFD/gC3P8wp8iv7cy/zPMdIc3PX1Mmx+YOy6XhUYp4R4JcgUlYa4 eIE4qtcQ2eOBLv1XOx8A4SZpTPdSTXhMu/rSl9N/yx3xoSBF7MwuJZDMhyojDpbmzqxt Ye6RNCg4H7jNxE+AeZySfMRo0fXgEQc1va6ULDdSPQ1r9WqNucTcgiC6YPHx5/5CegHM ddCxkeCHR9u+e6NxIJCbd1s7adaOIMmxUpjiKUEylENEyVEdxGNihOw2hGaVsKe3BHMU UYMA== MIME-Version: 1.0 X-Received: by 10.43.180.200 with SMTP id pf8mr2399539icc.50.1381535076471; Fri, 11 Oct 2013 16:44:36 -0700 (PDT) Date: Fri, 11 Oct 2013 17:44:36 -0600 Subject: Inter-process locking From: Jason Friedman To: python-list Content-Type: text/plain; charset=UTF-8 X-Mailman-Approved-At: Sat, 12 Oct 2013 03:31:35 +0200 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 17 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1381541497 news.xs4all.nl 15866 [2001:888:2000:d::a6]:49525 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:56718 I have a 3rd-party process that runs for about a minute and supports only a single execution at a time. $ deploy If I want to launch a second process I have to wait until the first finishes. Having two users wanting to run at the same time might happen a few times a day. But, these users will not have the skills/patience to check whether someone else is currently running. I'd like my program to be able to detect that "deploy" is already running, tell the user, wait a minute, try again, repeat. I do not know whether anyone has had success with http://pythonhosted.org/lockfile/lockfile.html. I supose I could use http://code.google.com/p/psutil/ to check for a process with a particular name.