Programmatically Getting Process ID

Samuel A. Falvo II kc5tja at
Sat Mar 4 01:18:04 CET 2000

In article <89pi3n$8lc$1 at>, Hernan M. Foffani wrote:
>The portable way to do it (in UN*X, I mean) is to run a script and get
>the output (via pipes), something like:

That's bloody insane.  There's no way to iterate through the list of running
processes and query them for name and ID?

>If you know in advance which daemons you are trying to kill, some of
>them leave a text file with the running pid. Just read it.

While I do know which ones I want to restart, they don't leave PID files.

Thanks for the information.  It seems that I have absolutely no way to
handle this except to use an exorbitantly expensive operation to determine
the PID of a running process... :(

(How the heck does PS get its process listing anyway?)

KC5TJA/6, DM13, QRP-L #1447
Samuel A. Falvo II
Oceanside, CA

More information about the Python-list mailing list