how to kill a python process?

Diez B. Roggisch deets at nospam.web.de
Sun Feb 5 12:24:05 EST 2006


MackS schrieb:
> 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...

Yes, you are. I'm not sure how to rename processes - but _if_ it kan be 
done, it means that somebody else could maybe do it, too - and in case 
of the same name is accidentially killed.

So - stick with the PID- After all, it is not _so_ cumbersome to keep a 
reference to e.g. popen-objects.

Diez



More information about the Python-list mailing list