[ale] How to move a running process to screen session
Jim Kinney
jim.kinney at gmail.com
Wed Dec 18 07:07:57 EST 2013
I'm may hack up my bash env and have it automatically show all my screen
sessions on login with a prompt to select one before continuing or
automatically start one if there isn't one.
On Tue, Dec 17, 2013 at 11:17 PM, Bruno Bronosky <richard at bronosky.com>wrote:
> Do you really need reptyer? I would have tried to do this with fg <pid>
>
> Not sure if it works as I'm pretty consistent at running tmux (what the
> cool kids use in place of screen these days)
> On Dec 17, 2013 10:29 PM, "Jim Kinney" <jim.kinney at gmail.com> wrote:
>
>> 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/>*
>>
>> _______________________________________________
>> Ale mailing list
>> Ale at ale.org
>> http://mail.ale.org/mailman/listinfo/ale
>> See JOBS, ANNOUNCE and SCHOOLS lists at
>> http://mail.ale.org/mailman/listinfo
>>
>>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo
>
>
--
--
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/20131218/d4dabdb0/attachment.html>
More information about the Ale
mailing list