简体   繁体   English

一段时间后,用户进程与 ssh 连接一起被杀死

[英]User processes getting killed along with ssh connection after some time

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.但过了一段时间,我的 ssh 连接被远程主机关闭的消息连接杀死。 And after that when i am checking all my java processes by ps - ef |之后,当我通过 ps - ef | 检查我的所有 java 进程时grep java, nothing is running (eg, tomcat ) again need to restart, everything is getting killed without any error message. grep java,什么都没有运行(例如, tomcat )再次需要重新启动,一切都被杀死,没有任何错误消息。 But meanwhile system services are running like mysql, mongo etc.但同时系统服务正在运行,如 mysql、mongo 等。

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.我想你在问两个问题:(a)为什么我的 SSH 连接被杀死,(b)为什么我的进程会因此而死。

On (a) I would suggest you look at options for SSH that serve to keep connections alive.在 (a) 上,我建议您查看用于保持连接活动的 SSH 选项。 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.在 (b) 上,您可能应该将 Tomcat 作为服务安装,这将保护它在您的 SSH 连接断开时不会被杀死。 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.完成此操作的详细信息可能会有所不同,具体取决于您使用的操作系统以及是否为 Linux,具体取决于发行版。 [These instructions for Ubuntu 16.04 might give you an idea of what is involved. [这些 Ubuntu 16.04 的说明可能会让您了解所涉及的内容。

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.如果您的进程现在很难变成服务,您还可以使用screen等工具在 SSH 连接断开时保持它们运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM