killing process

Mark d. mark at deverter.net
Thu Apr 8 15:11:01 EDT 2004


I have been trying to make this function run that is triggered from a 
button on a Python rendered webpage.  Clicking the button gets a 
processID, sends a kill command for the process and then generates a 
simple web page that displays the processID but the 'kill' command is 
not carried out.

def restart():
     pid =  os.popen('pidof myProcess').read().strip()
     os.popen('kill -9 %s' %pid, 'w').close()
     print CGI()
     print HTML(
         HEAD('restart', None),
         BODY(None,
             'process id:',
             pid
         ))
     return 1

This works just fine in the interpreter.
Anyone have any ideas what I am overlooking?

Cheers,
Mark d.




More information about the Python-list mailing list