从 PHP 启动屏幕以执行密集型 Java 应用程序
我想知道如何从 PHP 启动屏幕会话,我尝试过 shell_exec()、system() 和 passthru(),但没有成功。
我已经在脚本的执行时间内启动了屏幕会话,但是在完成加载后,它会终止刚刚创建的屏幕会话。 (通过启动屏幕会话并在同一脚本中执行“screen -list”)
有什么想法吗?
I am wondering how to start a screen session from PHP, I have tried with shell_exec(), system() and passthru(), but no avail.
I have gotten the screen session started for the execution time of the script, but after it has finished loading, it kills the screen session it just created. (By starting a screen session and executing 'screen -list' in the same script)
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要
bg
(背景)并disown
该进程,因为*nix使用进程树,如果进程的父进程终止,则其所有子进程也会终止,除非父母与孩子断绝关系
。根据您的 shell,在您执行的命令行末尾附加
&
应该足以为您完成此操作。通常,您在终端窗口中打开屏幕(我相信屏幕有内置的背景命令和否认自身),所以这并不重要
you'll want to
bg
(background) anddisown
the process because *nix uses a process tree such that if the parent of a process terminates all of its children terminate too unless the parentdisown
s the child.depending on your shell, appending an
&
to the end of the command line you execute should be sufficient to do this for you.Normally you open screen in a terminal window (and i believe screen has builtin commands to background and disown itself) so this wouldn't matter