Moving an already-running process to Screen

My workplace work consistently sees me attached to a Linux box using VNC.

Occasionally I start a remote work on the console, and also understand later on that it runs a lot longer than anticipated. (Should have begun that under Screen to begin with )

I do not intend to maintain my workstation running overnight simply to maintain the VNC session open ; I would love to relocate that currently - running remote work right into a Screen session (on the remote box), so I can power down the workstation (and also reconnect next early morning).

Just how can this be done, if in all?

261
2022-06-09 11:10:25
Source Share
Answers: 2

You can refrain this, conveniently. I would certainly recommend making it a behavior to start screen as the first point you do after opening up a console.

Nonetheless, for your real trouble, there is an additional point you can attempt: after having actually released your work from the incurable, history it by keying ctrl - z and afterwards bg. Afterwards, detach the work from it is parent covering ; in celebration you would certainly do disown -h %<jobid>. Afterwards, you can securely close the incurable and also the work will certainly proceed running.

53
2022-06-09 11:22:33
Source

As you are making use of Linux, what concerning making use of retty inside the freshly released screen procedure?

$ screen -S my_process
$ retty $(pgrep my_process)
/redraw
40
2022-06-09 11:18:34
Source