denyhosts

Chuck Swiger cswiger at mac.com
Wed Feb 22 06:04:46 PST 2006


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...?  :-)


More information about the freebsd-questions mailing list