[ale] How to move a running process to screen session

Jim Kinney jim.kinney at gmail.com
Tue Dec 17 22:21:54 EST 2013


Sometimes I start a process that is going to take far longer than I'm
willing to wait on and I forgot to load up a screen session to run in so if
my VPN connection dies my process dies with it. Such is the life of an
admin.

Here's a way to keep sanity a bit higher; transfer the pid to new screen
session.

How?

Easy!

You need to have screen (you _do_ have screen, right?
http://jimkinney.us/9.%2Bscreen.html), reptyr (pronounced re-p-t-y-er) and
be running in bash on the remote system.

In the shell where the long process is running, hit ctrl-z to pause the
process and then run bg to background it.
Now in another shell on the same system, start a screen session with
'screen'.
In the screen session, run 'reptyr <pid of long process>'
Now you can ctrl-a d and get off the system entirely and the process will
run in the new screen session.

Note: retty (old school version of reptyr) is replaced by reptyr as retty
is not happy at all with x86_64.

-- 
-- 
James P. Kinney III

Every time you stop a school, you will have to build a jail. What you gain
at one end you lose at the other. It's like feeding a dog on his own tail.
It won't fatten the dog.
- Speech 11/23/1900 Mark Twain


*http://heretothereideas.blogspot.com/
<http://heretothereideas.blogspot.com/>*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ale.org/pipermail/ale/attachments/20131217/80cd5673/attachment.html>


More information about the Ale mailing list