[ale] How to move a running process to screen session
Jim Kinney
jim.kinney at gmail.com
Tue Dec 17 22:29:01 EST 2013
I hit the send button a tad too soon.
On Tue, Dec 17, 2013 at 10:21 PM, Jim Kinney <jim.kinney at gmail.com> wrote:
> 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 run the bash shell command 'disown <pid of log process>' to fully
detach the process from the parent.
> 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.
>
Note2: The disown command usage will not appear in your history after it's
run so it's not possible to grep history for "how did I do that?" later.
>
> --
> --
> 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/>*
>
--
--
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/644ba30f/attachment-0001.html>
More information about the Ale
mailing list