42
votes
6answers
41k views

Starting a background process in python

I'm trying to port a shell script to the much more readable python version. The original shell script starts several processes (utilities, monitors, etc.) in the background with "&". How can I ...
27
votes
7answers
11k views

Is there a way to change effective process name in Python?

Can I change effective process name of a Python script? I want to show a different name instead of the real name of the process when I get the system process list. In C I can set ...
26
votes
4answers
13k views

How do I run another script in Python without waiting for it to finish?

I am creating a little dashboard for a user that will allow him to run specific jobs. I am using Django so I want him to be able to click a link to start the job and then return the page back to him ...
16
votes
3answers
4k views

How to add a timeout to a function in Python

Many attempts have been made in the past to add timeout functionality in Python such that when a specified time limit expired, waiting code could move on. Unfortunately, previous recipes either ...
14
votes
5answers
724 views

Only one python program running (like Firefox)?

When I open Firefox, then run the command: firefox http://somewebsite the url opens in a new tab of Firefox (same thing happens with Chromium as well). Is there some way to replicate this behavior ...
11
votes
6answers
2k views

subprocess: deleting child processes in Windows

On Windows, subprocess.Popen.terminate calls win32's TerminalProcess. However, the behavior I see is that child processes of the process I am trying to terminate are still running. Why is that? How do ...
11
votes
7answers
3k views

Python library for Linux process management

Through my web interface I would like to start/stop certain processes and determine whether a started process is still running. My existing website is Python based and running on a Linux server, so ...
10
votes
9answers
12k views

Kill process by name in python

I'm trying to kill a process (specifically iChat) using python. I know how to use the command: ps -A | grep iChat Then: kill -9 PID However, I'm not exactly sure how to translate these commands ...
10
votes
3answers
2k views

Python multiprocessing continuously spawns pythonw.exe processes without doing any actual work

I don't understand why this simple code # file: mp.py from multiprocessing import Process import sys def func(x): print 'works ', x + 2 sys.stdout.flush() p = Process(target= func, args= ...
10
votes
2answers
4k views

Get process name by PID

This should be simple, but I'm just not seeing it. If I have a process ID, how can I use that to grab info about the process such as the process name.
9
votes
5answers
9k views

How to retrieve the process start time (or uptime) in python

How to retrieve the process start time (or uptime) in python in Linux? I only know, I can call "ps -p my_process_id -f" and then parse the output. But it is not cool.
9
votes
1answer
314 views

Python: setting memory limit for a particular function call

In a Python script, I want to set a memory limit for a certain function call. I looked at how to limit heap size; however, I don't want to limit the memory of the entire running Python process -- i.e. ...
8
votes
4answers
623 views

Foolproof cross-platform process kill daemon

I have some python automation, which spawns telnet sessions that I log with the linux script command; there are two script process IDs (a parent and child) for each logging session. I need to solve a ...
8
votes
1answer
245 views

Check what a running process is doing

Is there a way on Linux to check what a running Python daemon process is doing? That is, without instrumenting the code and without terminating it? Preferably I'd like to get the name of the module ...
7
votes
2answers
15k views

spawning process from python

im spawning a script that runs for a long time from a web app like this: os.spawnle(os.P_NOWAIT, "../bin/producenotify.py", "producenotify.py", "xx",os.environ) the script is spawned successfully ...

1 2 3 4 5 19
15 30 50 per page