如何在后台运行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屋!