Python BaseHTTP gets struck while starting nginx or other services
<p>I am using BaseHTTP since its very simple. Please advice if I'm using it wrong.</p>

<pre><code>if self.path.endswith("nginxstart"):
    xxxxxx 
    status=os.system("/home/karthik/nginx/nginx-1.0.4/sbin/nginx");  #tried ls -l and works
    self.wfile.write("nginx restarted")
</code></pre>

<p>nginx gets started but doesn't write "nginx restarted" to browser until I kill the python server.
When I do netstat -anp | grep 'nginx's pid' there are two listening ports :</p>

<ol>
<li>python server was listening  (port 8000: which I have killed)</li>
<li>on which nginx was supposed to be running.</li>
</ol>

<p>Works great if i run simple shell commands os.system("ls -l") and so on. </p>

<p>Works great if I run the same as a normal python script, not as a web server.</p>

<p>Tried starting some other services also not working.
I tried with try catch, catch part is not getting executed.
The browser is in connecting/receiving state forever.</p>

<p>Any help on this please ?</p>
