473,395 Members | 1,680 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,395 software developers and data experts.

Get the status of a process

Hi,

I'm pretty brain dead reading the python docs about the processes.

I'm looking for some pythonig way to do a...

$ ps x | grep <some_pid>

.... in order to know if <some_pid> is running or not.

Thanks in advance for any hint.

--
Gilles

Jul 18 '05 #1
2 2525
Gilles Lenfant <no*************@bigfoot.com> writes:
Hi,

I'm pretty brain dead reading the python docs about the processes.

I'm looking for some pythonig way to do a...

$ ps x | grep <some_pid>

... in order to know if <some_pid> is running or not.

Thanks in advance for any hint.


os.kill(some_pid, 0)?

You might get EPERM if the process is running, but as a different
user.

Cheers,
mwh

--
Gullible editorial staff continues to post links to any and all
articles that vaguely criticize Linux in any way.
-- Reason #4 for quitting slashdot today, from
http://www.cs.washington.edu/homes/k.../slashdot.html
Jul 18 '05 #2
Michael Hudson wrote:

os.kill(some_pid, 0)?

You might get EPERM if the process is running, but as a different
user.

Cheers,
mwh


Many thanks. This does the job (raises an OSError when process is dead)

--
Gilles

Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Ishwar Rattan | last post by:
Here is a piece code (according to blurb on os.wait, the lower order 7 bits of exit status of process should contain the signal number of signal that terminated the process..) and signal number...
1
by: yyii | last post by:
Hi, I have a problem on retreiving the status of the child process. I want to open IE and load local file. Just after it is loaded, I need to delete that local file. It seems that I can't use...
8
by: mark4asp | last post by:
Why won't the window.status message change ? IE ver. 6.0.2800.1106 displays the tooltip OK. <td> <A HREF="editAuthor.asp?item=4" title="Edit author details"...
2
by: seash | last post by:
hi I wrote a class like this.......in my application. public class cls { public static extern bool myApp ( ref string aa,
3
by: bygandhi | last post by:
Hi - I am writing a service which will check a process and its threads for their state ( alive or dead ). The process has 5 .net managed threads created using thread.start and each have been...
1
by: Francis | last post by:
Hi everyone, I was just wondering if anyone could help me. I am writing a small win32 app using C#/.net. When something is executed, I want to put in a counter which counts up how long the process...
1
by: Velhari | last post by:
Hi all, I Need your help....... I developed the code for multiple file upload in PHP. In My Program there is 3 File Input type ==> Getting the File Name 3 iFrame tags ==>...
18
by: mistral | last post by:
Is there some other (more advanced) effects for status bar, other than standard Scroller Bar, TypeWriter Scroller, Flashing Bar, Decrypter, Ticker, World Clock?
4
by: frozenade | last post by:
Hello all.. merry christmas.. :) I need to show progress status when a button is clicked. I use this script. but I know that this code is still very bad. <html>
0
by: Edwin.Madari | last post by:
updated creature running in its own thread will get you started. try it foryourself, change sleep times per your need. import os, sys, threading, time class Creature: def __init__(self,...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.