This question already has answers here:
How do I put an already-running process under nohup?
(10个答案)
我正在远程服务器(redhat linux)中运行一个需要很长时间的进程。
我需要离开一段时间,我希望它在后台运行,不要在注销时停止。
就像
有什么方法可以做到这一点吗?
…稍后…
(10个答案)
我正在远程服务器(redhat linux)中运行一个需要很长时间的进程。
我需要离开一段时间,我希望它在后台运行,不要在注销时停止。
就像
nohup command &
有什么方法可以做到这一点吗?
最佳答案
您可以使用GNU Screen或tmux
这些是终端多路复用器,允许您启动进程并将其从控制台分离。然后您可以注销并稍后重新连接。
例如,带屏幕
screen -S title
# start your process inside screen
Ctrl A D # to detach
logout
…稍后…
login
screen -r title # re attach