killing process

M

Mark d.

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.
 
A

Aloysio Figueiredo

* Mark d. said:
This works just fine in the interpreter.
Anyone have any ideas what I am overlooking?

Perhaps the user running apache is not allowed to kill the process...

Cheers,
Aloysio
Cheers,
Mark d.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAda6x3Z98a+m7958RAoBSAJ9Jl2vkD5jfaaBncnAQqrgt3fPdUwCfTltv
ziZ0amH2LsqyNH7MsOa7PGk=
=Y/YJ
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,828
Latest member
LauraCastr

Latest Threads

Top