Check for running DHCP daemon?

Jason Bailey JBailey at
Thu Jan 22 04:58:29 CET 2015

How would I get a list of running processes with the subprocess module? The documentation wasn't clear to me.

On Jan 21, 2015 7:21 PM, Dan Stromberg <drsalists at> wrote:
On Wed, Jan 21, 2015 at 3:06 PM, Jason Bailey <jbailey at> wrote:
> So I've got this python 3 script that needs to know if there is a running
> DHCP daemon (ISC DHCP server) on the local system. Is there a clean way to
> do this that (1) doesn't require me to do syscalls to local utilities (like
> ps, top, etc), and (2) doesn't require any custom modules (stock only)?

The subprocess module is quite clean on *ix.  Don't let the subprocess
mess on Windows steer you away from it on *ix.  And don't let the
"subprocesses are bad" from the perl community misguide you either -
shell is fast today because it's highly parallel, because it's
unafraid of subprocesses.

You could open the files under /proc and look around, if you're on
Linux. But parsing "ps -eo whatever" would probably be cleaner.

A "syscall" is an interaction with a kernel.  I think you meant an
os.system() call.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list