<div dir="ltr">fg only works within the same pty, screen allocates new pty(s). Also, closing the external session would send SIGHUP to any process in the process group.</div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Tue, Dec 17, 2013 at 8:17 PM, Bruno Bronosky <span dir="ltr"><<a href="mailto:richard@bronosky.com" target="_blank">richard@bronosky.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<p dir="ltr">Do you really need reptyer? I would have tried to do this with fg <pid></p>
<p dir="ltr">Not sure if it works as I'm pretty consistent at running tmux (what the cool kids use in place of screen these days)</p>
<div class="gmail_quote"><div><div class="h5">On Dec 17, 2013 10:29 PM, "Jim Kinney" <<a href="mailto:jim.kinney@gmail.com" target="_blank">jim.kinney@gmail.com</a>> wrote:<br type="attribution"></div></div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
<div dir="ltr">I hit the send button a tad too soon.<br><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Dec 17, 2013 at 10:21 PM, Jim Kinney <span dir="ltr"><<a href="mailto:jim.kinney@gmail.com" target="_blank">jim.kinney@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div><div><div><div>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.<br>
<br></div>Here's a way to keep sanity a bit higher; transfer the pid to new screen session.<br><br></div>How?<br><br></div>Easy!<br><br></div>You need to have screen (you _do_ have screen, right? <a href="http://jimkinney.us/9.%2Bscreen.html" target="_blank">http://jimkinney.us/9.%2Bscreen.html</a>), reptyr (pronounced re-p-t-y-er) and be running in bash on the remote system.<br>
<br></div>In the shell where the long process is running, hit ctrl-z to pause the process and then run bg to background it.<br></div></div></div></div></div></blockquote><div><br></div><div>Now run the bash shell command 'disown <pid of log process>' to fully detach the process from the parent.<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div></div>Now in another shell on the same system, start a screen session with 'screen'.<br>
</div>In the screen session, run 'reptyr <pid of long process>'<br></div>Now you can ctrl-a d and get off the system entirely and the process will run in the new screen session.<br><br></div>Note: retty (old school version of reptyr) is replaced by reptyr as retty is not happy at all with x86_64.<span><font color="#888888"><br clear="all">
</font></span></div></blockquote><div><br></div><div>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.<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span><font color="#888888">
<div><div><div><div><div><div><div><div><div><div><br>-- <br><div dir="ltr">-- <br>James P. Kinney III<br><i><i><i><i><br></i></i></i></i>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.<br>
- Speech 11/23/1900 Mark Twain<br><i><i><i><i><br><a href="http://heretothereideas.blogspot.com/" target="_blank">http://heretothereideas.blogspot.com/</a><br></i></i></i></i></div>
</div></div></div></div></div></div></div></div></div></div></font></span></div>
</blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr">-- <br>James P. Kinney III<br><i><i><i><i><br></i></i></i></i>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.<br>
- Speech 11/23/1900 Mark Twain<br><i><i><i><i><br><a href="http://heretothereideas.blogspot.com/" target="_blank">http://heretothereideas.blogspot.com/</a><br></i></i></i></i></div>
</div></div></div>
<br></div></div>_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org" target="_blank">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
<br></blockquote></div>
<br>_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>David Tomaschik<br>OpenPGP: 0x5DEA789B<br><a href="http://systemoverlord.com" target="_blank">http://systemoverlord.com</a><br><a href="mailto:david@systemoverlord.com" target="_blank">david@systemoverlord.com</a>
</div>