Spawning a new process from Python
Jan Dries
jan.dries at dcube-resource.be
Sat Jan 4 21:00:49 EST 2003
I'm trying to start a process from within a Python script. The process
is a commercial application (ASP server) written in Java. This ASP
server tends to hang from time to time, and my Python scripts tries to
detect that, kills all ASP child processes, and then starts the server
again. It starts as root (to kill the processes) and then switches to
used nobody (with os.setuid()) to start the ASP server again.
I can kill the server properly, but can't get it running again. At the
command prompt, I normally start it with:
/path/to/start-server.sh &
which is a script that actually starts the Java VM with some parameters.
I've tried various things in Python:
os.system("/path/to/start-server.sh &")
os.spawnv(os.P_NOWAIT,...)
os.spawnv(os.P_WAIT,...)
os.execl(...)
os.execve(...)
...
With some of these instructions I can manage to seemingly get the ASP
server running, but once the web server tries to connect to it, it gives
an internal server error.
Does anybody have any idea what I might be doing wrong?
I'm using Python 2.1.3 on Debian Linux.
Regards,
Jan
More information about the Python-list
mailing list