473,327 Members | 2,074 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 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 4051

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

Similar topics

1
by: Guy | last post by:
Hi I've done some projects in python for my work which invole some test scripts etc. All quite basic stuff, I find python a good language to work in but have come up against a brick wall. I'm...
2
by: curious_one | last post by:
Hi, Is there a way to access a single instance of an object(singleton class) across different processes ? thanks curious.one
9
by: JennaS | last post by:
Hi. I was just wondering if you can fork a process in .NET like you would in C Thank Jenna
3
by: Billg_sd | last post by:
Is there a programatic way in VB.NET to determine if a specific process is running? During an app update, I need to check if the component I'm about to replace is running. In UNIX I'd use: PS |...
2
by: murray_shane56 | last post by:
We currently have a routine that "forks" out (to use the unix term)TSQL commands to run asynchronously via SQL Agent jobs. Each TSQL command gets its own Job, and the job starts immediately after...
7
by: roopeman | last post by:
i can search objects in AD,someone can tell me how to get the online Computers in AD ?
0
markryan57
by: markryan57 | last post by:
Greetings, I have seen different ideas on how to terminate active processes (i.e., MS Access, Excel, etc) from VB6 - what is the most effecient method of finding and terminating active processes? ...
21
by: Tom Gur | last post by:
Hi, It's seems that csh and tcsh acts a bit different when handling special characters in quotes. i.e: if i'll supply my program with the following arguments: -winpath "c:\\temp\\" tcsh will...
0
by: m.gelosa | last post by:
Dear all, I wrote some weeks ago about a problem with all the committing transactions blocked for many seconds in a Commit Active state. Well, finally I solved it and I just would like to share...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.