9

I started an big operation, but I didn't start a screen session, So i can't disconnect without canceling the operation.

Is there a way to inject screen so that the operation continues and sends its output to the screen session and i can safely disconnect my ssh session?

Bob Fanger
  • 351
  • 3
  • 9
  • possible duplicate of [Is it possible to detach a process from its terminal? (Or, "I should have used screen!")](http://serverfault.com/questions/34750/is-it-possible-to-detach-a-process-from-its-terminal-or-i-should-have-used-sc) – Dennis Williamson May 22 '10 at 17:24

2 Answers2

5

After browsing your "No." link I actually found this answer on serverfault from earl:

However, for your actual problem, there's another thing you could try: after having launched your job from the terminal, background it by typing ctrl-z and then bg. After that, detach the job from it's parent shell - in bash: disown -h %<jobid>. After that, you can safely close the terminal and the job will continue running.

And this one from the same question from Rob Wells:

$ screen -S my_process
$ retty $(pgrep my_process)
/redraw

Adam Haun
  • 103
  • 4
Bob Fanger
  • 351
  • 3
  • 9
  • 1
    In the linked question, reptyr worked better than retty for me. retty detached but wasn't able to reattach. – Leo Jul 09 '14 at 21:19
2

Short answer is no. Long answer is maybe. Good luck.

Warner
  • 23,440
  • 2
  • 57
  • 69