how to kill a python process?

Steve Horsley steve.horsley at gmail.com
Fri Feb 10 16:46:51 EST 2006


MackS wrote:
> Hello!
> 
> This question does not concern programming in python, but how to manage
> python processes. Is there a way to "name" a python process? At least
> on Linux, if I have two python programs running, they both run under
> the name "python"
> 
> #pidof program1.py
> [empty line]
> #pidof program1.py
> [empty line]
> # pidof python
> 1249 854
> 
> Is there a way to make them run under their own names, e.g., to make it
> easier to kill them by name using killall? Or am I stuck with
> registering the pid of each python process I create and then refer to
> that list whenever I need to selectively stop one of them? The latter
> makes managing a long list of processes very cumbersome...
> 
> Thanks for any help!
> 
> Mack
> 

I ran a script called test, and found this in my process list 
(sorry, the emailer wraps it):

steve    14513 14452  0 21:43 pts/2    00:00:00 /usr/bin/python 
./test

But I also find that "killall test" kills it. So you don't need 
"killall python" at all.

HTH
Steve




More information about the Python-list mailing list