通过 ssh 运行持久进程 [英] Run a persistent process via ssh
问题描述
我正在尝试通过 ssh 启动测试服务器,但是一旦我与 ssh 断开连接,它总是死机.
I'm trying to start a test server via ssh but it always dies once i disconnect from ssh.
有没有办法启动一个进程(运行服务器),这样它就不会在我的 ssh 会话结束时死掉?
Is there a way to start a process (run the server) so it doesn't die upon the end of my ssh session?
推荐答案
作为 nohup
,您可以在终端多路复用器中运行远程应用程序,例如 GNU screen
或 tmux
.
As an alternative to nohup
, you could run your remote application inside a terminal multiplexor, such as GNU screen
or tmux
.
使用这些工具可以轻松地从另一台主机重新连接到会话,这意味着您可以在下班前启动长时间的构建或下载,并在您回家时检查其状态.例如.我发现这在我和他们之间连接不可靠的非常远程(在不同国家/地区)的服务器上进行开发工作时特别有用,如果连接断开,我可以简单地重新连接并继续进行,而不会丢失任何状态.
Using these tools makes it easy to reconnect to a session from another host, which means that you can kick a long build or download off before you leave work and check on its status when you get home. For instance. I find this particularly useful when doing development work on servers that are very remote (in a different country) with unreliable connectivity between me and them, if the connection drops, I can simply reconnect and carry on without losing any state.
这篇关于通过 ssh 运行持久进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!