为什么在启动基础服务器上的守护程序后挂起网页? [英] Why hangs the web page after it started a daemon on the underlying server?
问题描述
html是这样的:
$ b 我想通过一个简单的网页在家庭服务器上启动/停止守护进程。$ b
< form action =http://192.168.2.101/cgi-bin/managedaemon.plmethod =post>
< input type =submitvalue =Startname =start/>
< input type =submitvalue =Stopname =stop/>
< / form>
managedaemon.pl是这样的:
#!/ usr / bin / perl
系统(/ usr / local / theprog / startserver);
printContent-type:text / html\r\\\
\r\\\
;
打印< html>;
...
startserver是这样的:
#!/ bin / bash
cd / usr / local / theprog
./theprogserver -daemon
当我从命令行执行Perl脚本时,守护进程正常启动并且脚本终止。 b $ b但是,当我从Web浏览器触发它时,守护进程将启动,但页面会挂起,直到刚启动的守护进程被终止。
请让我知道如何避免这种'悬挂'。
谢谢,
Marton
你的守护进程可能没有正确分离,本有关守护进程的答案包含所需步骤的良好总结
I would like to start/stop a daemon process on my home server via a simple web page.
The html is like this:
<form action="http://192.168.2.101/cgi-bin/managedaemon.pl" method="post">
<input type="submit" value="Start" name="start"/>
<input type="submit" value="Stop" name="stop"/>
</form>
The managedaemon.pl is like this:
#!/usr/bin/perl
system("/usr/local/theprog/startserver");
print "Content-type:text/html\r\n\r\n";
print "<html>";
...
And the startserver is like this:
#!/bin/bash
cd /usr/local/theprog
./theprogserver -daemon
When I execute the Perl script from the command line, the daemon process is started properly and the script is terminated.
However, when I trigger it from the web browser, the daemon process is started, but the page hangs until the just started daemon is killed.
Please let me know how could I avoid this 'hanging'.
Thanks, Marton
Your daemon is probably not detaching properly, This SO Answer about daemonizing contains a good summary of the steps required
这篇关于为什么在启动基础服务器上的守护程序后挂起网页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!