通过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
,您可以在终端多路复用器中运行远程应用程序,例如 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屋!