473,287 Members | 2,682 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,287 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 4050

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: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
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)...

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.