如何在后台运行 Solr Jetty [英] How to run Solr Jetty in background
问题描述
我正在使用 Solr 附带的 Jetty/Solr 构建,并希望在后台而不是在终端中运行它.
I am using the Jetty/Solr build that comes with Solr and would like to run it in the background instead of in the terminal.
现在我通过 java -jar start.jar
启动它,但我希望它登录到一个文件并在服务器的后台运行,以便我可以关闭终端窗口.
Right now I start it by java -jar start.jar
but I would like it to log to a file and run in the background on the server so that I can close the terminal window.
我确定有一些我找不到的 java 配置.
I'm sure there is some java config that I can't find.
我已经尝试过 java -jar start.jar >log.txt &
但没有运气仍然输出到终端窗口.
I have tried java -jar start.jar > log.txt &
but no luck still outputs to the terminal window.
谢谢.
推荐答案
尝试类似:
nohup yourcommand > output.log 2>&1 &
nohup 将防止您的命令在您注销时被终止.
nohup will prevent yourcommand from being terminated in the event you log out.
& 将在后台运行.
> output.log 将标准输出发送到 output.log
> output.log will send stdout to output.log
2>&1 会将 stderr 重定向到 stdout
2>&1 will redirect stderr to stdout
这篇关于如何在后台运行 Solr Jetty的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!