I started to compile android for my phone using a putty/ssh connection to my ubuntu server, but forgot to open a "screen" before hand. It's been running for a couple hours and I need to turn off my windows computer to sleep. Is there a way to move the session into a screen session, so I don't have to interrupt it? Or will closing the putty session not interfere with the build?
Asked
Active
Viewed 3,997 times
1 Answers
12
yes! the only way I know of is using 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.)

JJD
- 392
- 4
- 13
-
Thank you very much! This will save me headaches in the future. – Sergio Ramos Nov 23 '13 at 09:10