2013-11-23 73 views
7

我開始使用putty/ssh連接到我的ubuntu服務器上爲我的手機編譯android,但忘記先打開「屏幕」。它已經運行了幾個小時,我需要關閉我的Windows電腦進入睡眠狀態。有沒有辦法將會話移動到屏幕會話中,所以我不必中斷它?或者關閉膩子會話不會影響構建?我可以將活動終端會話移動到屏幕會話嗎?

回答

4

是的!我知道的唯一途徑是使用reptyr https://github.com/nelhage/reptyr http://monkeypatch.me/blog/move-a-running-process-to-a-new-screen-shell.html

reptyr - A tool for "re-ptying" programs. 

reptyr is a utility for taking an existing running program and attaching it to a 
new terminal. Started a long-running process over ssh, but have to leave and don't 
want to interrupt it? Just start a screen, use reptyr to grab it, and then kill the 
ssh session and head on home. 

USAGE 

reptyr PID 

"reptyr PID" will grab the process with id PID and attach it to your current terminal. 
After attaching, the process will take input from and write output to the new terminal, 
including ^C and ^Z. (Unfortunately, if you background it, you will still have to run "bg" 
or "fg" in the old terminal. This is likely impossible to fix in a reasonable way without 
patching your shell.) 
+0

非常感謝您!這將使我在未來避免頭痛。 –