用户进程在一段时间后与 SSH 连接一起被终止。

huangapple 未分类评论49阅读模式
英文:

User processes getting killed along with ssh connection after some time

问题

最近我遇到了这个问题。所有的服务都正常运行。但是过一段时间后,我的SSH连接被一个"连接被远程主机关闭"的消息中断了。在那之后,当我用"ps -ef | grep java"命令检查所有的Java进程时,没有任何进程在运行(比如Tomcat),我不得不再次重启,所有的东西都被关闭,没有任何错误消息。但与此同时,系统服务如MySQL、Mongo等仍在运行。

英文:

Recently i am facing this issue. All services are running fine . But after some time , my ssh connection is getting killed by a message connection closed by remote host. And after that when i am checking all my java processes by ps - ef | grep java , nothing is running (e.g, tomcat ) again need to restart, everything is getting killed without any error message. But meanwhile system services are running like mysql , mongo etc.

答案1

得分: 0

我认为你提出了两个问题:(a) 为什么我的SSH连接会被中断,以及(b) 为什么我的进程会因此而终止。

关于问题 (a),我建议您查看一些用于保持连接活跃的SSH选项。这个链接可能会有帮助

关于问题 (b),您可能应该将Tomcat安装为一个服务,这样当您的SSH连接断开时,它就不会被终止。具体的操作步骤可能会因您所使用的操作系统而异,如果是Linux系统,则还会取决于发行版。[这些针对Ubuntu 16.04的说明可能会让您对涉及的步骤有个大致的了解。

如果您有一些难以立即转化为服务的进程,您还可以使用工具如screen,在SSH连接断开时保持它们运行。

英文:

I think you are asking two questions: (a) why are my SSH connections getting killed and (b) why do my processes die as a result.

On (a) I would suggest you look at options for SSH that serve to keep connections alive. This might be useful.

On (b) you should probably install Tomcat as a service, which would protect it from getting killed when your SSH connection dies. The details of how this gets done might differ depending on what operating system you use and if it is Linux depending on the distribution. [These instructions for Ubuntu 16.04 might give you an idea of what is involved.

If you have processes that are too difficult to turn into a service right now, you can also use tools such as screen to keep them running while the SSH connection is down.

huangapple
  • 本文由 发表于 2020年7月26日 11:33:21
  • 转载请务必保留本文链接:https://java.coder-hub.com/63095811.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定