471,349 Members | 1,355 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,349 software developers and data experts.

How to get a list of active processes under Unix

12
Hi All!
I am writting a small script that will find a parent pid and from this point find a parent of a parent in order to kill this last parent :-)

I know it sounds stange (at least ... ) but this is really what i have to do. So

When the script starts it find it's parent pid, like this

Expand|Select|Wrap|Line Numbers
  1. ppid = os.getppid()
Afterwards a list of active processes is fetched from a console command ps -Af as follows:

Expand|Select|Wrap|Line Numbers
  1. buffer = commands.getoutput("ps -Af")
and latter on using regular expression syntax i get a parrent process id of a ppid i have stored at the beginnig.

My question is, is there any "python" way to get a list of active processes? I mean not using "ps - Af" command.
It's not i don't want to do it this way, i am just curious :-)

Thanks in advance for any hints!

Best regards,
Oct 19 '07 #1
0 3984

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Guy | last post: by
2 posts views Thread by curious_one | last post: by
9 posts views Thread by JennaS | last post: by
3 posts views Thread by Billg_sd | last post: by
2 posts views Thread by murray_shane56 | last post: by
21 posts views Thread by Tom Gur | last post: by
reply views Thread by m.gelosa | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.