Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在远程 CentOS VM Geddy 应用程序中部署了 MonogoDB 包装器。执行以下命令时,应用程序启动并侦听端口 80。
geddy -e production &
此 CLI 命令中的问题是,当与 VM 的 SSH 连接断开时,进程会自动关闭。要使应用程序正常工作,SSH 需要始终打开,这是不可能的。有没有其他方法可以让它作为后台服务运行。
SIGHUP发生这种情况是因为当它们的控制终端(SSH 连接)关闭时,仅后台的进程将收到一个信号。
SIGHUP
防止这种情况的传统方法是使用该nohup实用程序:
nohup
nohup geddy -e production &
或者,您可以使用终端多路复用器screen或tmux创建持久终端会话(在您注销时保持活动状态,并且可以在您稍后再次登录时重新连接)。
screen
tmux