关闭终端窗口后,Jetty服务器停止运行 [英] Jetty server stops running after closing terminal window

查看:200
本文介绍了关闭终端窗口后,Jetty服务器停止运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Java和Jetty应用程序部署方面,我是新手。我使用默认设置来设置我的码头服务,并在终端窗口上运行 java -jar start.jar 。服务器按预期运行,但当我关闭终端时它会停止。这是正常的吗?我之前和之前都使用过XAMPP,你可以毫无问题地关闭终端。我如何克服这个问题,每个人都需要偶尔关闭那台个人电脑。

I am a newbie when it comes to Java and Jetty app deployment. I use the default settings for setting up my jetty serve and ran java -jar start.jar on my terminal window. The server runs as expected, but when I close my terminal it stops. Is this normal? I used XAMPP before and there you can close the terminal without any problem. How do I overcome this problem, everybody needs to shut down there personal computer once in a while.

我正在使用mac btw。

I'm using a mac btw.

推荐答案

听起来你正在使用ssh或类似东西在远程Linux / Unix服务器上启动Jetty。

It sounds like you're using ssh or something like that to start Jetty on a remote Linux/Unix server.

所以,你可以使用 nohup java -jar start.jar& - nohup 会阻止当您注销时,您的过程会被通常的Unix挂断信号( ref )停止,并且& 会将jetty作为后台进程,因此您可以键入 exit 或其他任何要注销的内容。

So, you can use nohup java -jar start.jar & - nohup will prevent your process from being stopped by the usual Unix "hangup" signal (ref) when you log out, and the & will put jetty as a background process so you can type exit or whatever to log out.

如果您希望能够重新连接到Jetty终端,我建议您阅读 GNU screen

If you want to be able to re-attach to the Jetty terminal, I'd recommend reading up on GNU screen.

如果你想再次优雅地停止码头,我会真的建议使用它作为服务,或使用屏幕以避免丢失终端。但如果为时已晚,您可以在 jps -l <​​/ code>的输出中找到PID,然后调用 kill $ PID

If you want to stop jetty gracefully again, I'd really recommend using it as a service, or using screen to avoid losing the terminal. But if it's too late for that you can find the PID in the output of jps -l and then call kill $PID.

这篇关于关闭终端窗口后,Jetty服务器停止运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆