Date: Wed, 22 Feb 2006 09:04:48 -0500 From: Chuck Swiger <cswiger@mac.com> To: Robin Becker <robin@reportlab.com> Cc: freebsd-questions@freebsd.org Subject: Re: denyhosts Message-ID: <43FC6F80.7080809@mac.com> In-Reply-To: <43FC380E.9020808@chamonix.reportlab.co.uk> References: <43FC380E.9020808@chamonix.reportlab.co.uk>
next in thread | previous in thread | raw e-mail | index | archive | help
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...? :-)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?43FC6F80.7080809>