From owner-freebsd-questions@FreeBSD.ORG Wed Feb 22 14:04:45 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id ED39D16A420 for ; Wed, 22 Feb 2006 14:04:45 +0000 (GMT) (envelope-from cswiger@mac.com) Received: from pi.codefab.com (pi.codefab.com [199.103.21.227]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7040A43D46 for ; Wed, 22 Feb 2006 14:04:45 +0000 (GMT) (envelope-from cswiger@mac.com) Received: from localhost (localhost [127.0.0.1]) by pi.codefab.com (Postfix) with ESMTP id D10135CB6; Wed, 22 Feb 2006 09:04:44 -0500 (EST) Received: from pi.codefab.com ([127.0.0.1]) by localhost (pi.codefab.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 63498-09; Wed, 22 Feb 2006 09:04:44 -0500 (EST) Received: from [192.168.1.3] (pool-68-160-199-129.ny325.east.verizon.net [68.160.199.129]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by pi.codefab.com (Postfix) with ESMTP id CBDD15C48; Wed, 22 Feb 2006 09:04:43 -0500 (EST) Message-ID: <43FC6F80.7080809@mac.com> Date: Wed, 22 Feb 2006 09:04:48 -0500 From: Chuck Swiger Organization: The Courts of Chaos User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: Robin Becker References: <43FC380E.9020808@chamonix.reportlab.co.uk> In-Reply-To: <43FC380E.9020808@chamonix.reportlab.co.uk> X-Enigmail-Version: 0.94.0.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at codefab.com Cc: freebsd-questions@freebsd.org Subject: Re: denyhosts X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Feb 2006 14:04:46 -0000 Robin Becker wrote: > I'm trying out the denyhosts port; it starts up and performs as expected, > but it won't recognize a running instance as this python if test fails. > Is there a more freebsd way for python to find out if a given process is > running? > > if os.access(os.path.join("/proc", str(pid)), os.F_OK): > return pid > else: > return STATE_LOCK_EXISTS > If you know the pid, see whether you can deliver a continue signal to it: try: os.kill(pid, signal.SIGCONT) return pid except OSError: return STATE_LOCK_EXISTS -- -Chuck PS: "STALE_LOCK_EXISTS", maybe...? :-)