<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Redirecting Output from a Running Process</title>
	<atom:link href="http://etbe.coker.com.au/2008/02/27/redirecting-output-from-a-running-process/feed/" rel="self" type="application/rss+xml" />
	<link>http://etbe.coker.com.au/2008/02/27/redirecting-output-from-a-running-process/</link>
	<description>Linux, politics, and other interesting things</description>
	<pubDate>Sun, 07 Sep 2008 15:12:22 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1</generator>
		<item>
		<title>By: wilq</title>
		<link>http://etbe.coker.com.au/2008/02/27/redirecting-output-from-a-running-process/#comment-14930</link>
		<dc:creator>wilq</dc:creator>
		<pubDate>Fri, 18 Jul 2008 23:51:03 +0000</pubDate>
		<guid isPermaLink="false">http://etbe.coker.com.au/2008/02/27/redirecting-output-from-a-running-process/#comment-14930</guid>
		<description>This method doesn't work for me - when I try to redirect command "cat" to another controlling tty (e.g. from pts/2  to  tty1). I do the steps exactly as described above, but finally setsid() returns -1 , and if I (before quitting from gdb) run  "ps aux&#124;grep cat"  it still indicates the old tty.  And what is worse, - right after I quit from gdb (q), "cat" procsess immediately dies. So I think it's not enough just to change all file descriptors of ttys used by cat, it's also necessary to change somehow controlling tty, so that  "ps aux&#124;grep cat" would show the new tty, rather than old one.
What do I wrong ? Please help.</description>
		<content:encoded><![CDATA[<p>This method doesn&#8217;t work for me - when I try to redirect command &#8220;cat&#8221; to another controlling tty (e.g. from pts/2  to  tty1). I do the steps exactly as described above, but finally setsid() returns -1 , and if I (before quitting from gdb) run  &#8220;ps aux|grep cat&#8221;  it still indicates the old tty.  And what is worse, - right after I quit from gdb (q), &#8220;cat&#8221; procsess immediately dies. So I think it&#8217;s not enough just to change all file descriptors of ttys used by cat, it&#8217;s also necessary to change somehow controlling tty, so that  &#8220;ps aux|grep cat&#8221; would show the new tty, rather than old one.<br />
What do I wrong ? Please help.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: etbe</title>
		<link>http://etbe.coker.com.au/2008/02/27/redirecting-output-from-a-running-process/#comment-12853</link>
		<dc:creator>etbe</dc:creator>
		<pubDate>Mon, 07 Apr 2008 12:21:23 +0000</pubDate>
		<guid isPermaLink="false">http://etbe.coker.com.au/2008/02/27/redirecting-output-from-a-running-process/#comment-12853</guid>
		<description>http://sourceforge.net/projects/dmtcp

The above SourceForge project seems to do similar things to CryoPID, and they are working on suspending the state of a cluster too.</description>
		<content:encoded><![CDATA[<p><a href="http://sourceforge.net/projects/dmtcp" rel="nofollow">http://sourceforge.net/projects/dmtcp</a></p>
<p>The above SourceForge project seems to do similar things to CryoPID, and they are working on suspending the state of a cluster too.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: etbe</title>
		<link>http://etbe.coker.com.au/2008/02/27/redirecting-output-from-a-running-process/#comment-12455</link>
		<dc:creator>etbe</dc:creator>
		<pubDate>Tue, 04 Mar 2008 23:34:54 +0000</pubDate>
		<guid isPermaLink="false">http://etbe.coker.com.au/2008/02/27/redirecting-output-from-a-running-process/#comment-12455</guid>
		<description>http://cryopid.berlios.de/
CryoPID allows suspending the state of a running process via ptrace and then restarting it later (after a reboot etc).

http://www.fazlamesai.net/?a=article&#038;sid=4951
Thanks to the above blog post for pointing this out.</description>
		<content:encoded><![CDATA[<p><a href="http://cryopid.berlios.de/" rel="nofollow">http://cryopid.berlios.de/</a><br />
CryoPID allows suspending the state of a running process via ptrace and then restarting it later (after a reboot etc).</p>
<p><a href="http://www.fazlamesai.net/?a=article&#038;sid=4951" rel="nofollow">http://www.fazlamesai.net/?a=article&#038;sid=4951</a><br />
Thanks to the above blog post for pointing this out.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Todd Troxell</title>
		<link>http://etbe.coker.com.au/2008/02/27/redirecting-output-from-a-running-process/#comment-12404</link>
		<dc:creator>Todd Troxell</dc:creator>
		<pubDate>Wed, 27 Feb 2008 20:15:44 +0000</pubDate>
		<guid isPermaLink="false">http://etbe.coker.com.au/2008/02/27/redirecting-output-from-a-running-process/#comment-12404</guid>
		<description>Awesome-- I had no idea gdb could run function calls!</description>
		<content:encoded><![CDATA[<p>Awesome&#8211; I had no idea gdb could run function calls!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Russell Coker : redirecting output from a running process &#124; vanimpe.eu</title>
		<link>http://etbe.coker.com.au/2008/02/27/redirecting-output-from-a-running-process/#comment-12401</link>
		<dc:creator>Russell Coker : redirecting output from a running process &#124; vanimpe.eu</dc:creator>
		<pubDate>Wed, 27 Feb 2008 13:15:20 +0000</pubDate>
		<guid isPermaLink="false">http://etbe.coker.com.au/2008/02/27/redirecting-output-from-a-running-process/#comment-12401</guid>
		<description>[...] log out. Of course, you&#8217;ve forgotten to use screen so when you log out, the process dies. The post by Rusell Coker shows that it is still possible to redirect the output of a running process. The [...]</description>
		<content:encoded><![CDATA[<p>[...] log out. Of course, you&#8217;ve forgotten to use screen so when you log out, the process dies. The post by Rusell Coker shows that it is still possible to redirect the output of a running process. The [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steinar H. Gunderson</title>
		<link>http://etbe.coker.com.au/2008/02/27/redirecting-output-from-a-running-process/#comment-12397</link>
		<dc:creator>Steinar H. Gunderson</dc:creator>
		<pubDate>Wed, 27 Feb 2008 08:57:54 +0000</pubDate>
		<guid isPermaLink="false">http://etbe.coker.com.au/2008/02/27/redirecting-output-from-a-running-process/#comment-12397</guid>
		<description>Hi,

Two things to add here:

1. You can use "call" (IIRC) instead of "print" if you want to feel a tiny bit less hackish.
2. You're not guaranteed to get the same fd back on creat(), especially if there's another fd than 1 that you want to redirect. dup2() is your friend here.
3. cryopid can do this for interactive processes etc. too (say, your irssi), provided that you're prepared to lose all your sockets (without kernel patching).

/* Steinar */</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>Two things to add here:</p>
<p>1. You can use &#8220;call&#8221; (IIRC) instead of &#8220;print&#8221; if you want to feel a tiny bit less hackish.<br />
2. You&#8217;re not guaranteed to get the same fd back on creat(), especially if there&#8217;s another fd than 1 that you want to redirect. dup2() is your friend here.<br />
3. cryopid can do this for interactive processes etc. too (say, your irssi), provided that you&#8217;re prepared to lose all your sockets (without kernel patching).</p>
<p>/* Steinar */</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: RichiH</title>
		<link>http://etbe.coker.com.au/2008/02/27/redirecting-output-from-a-running-process/#comment-12396</link>
		<dc:creator>RichiH</dc:creator>
		<pubDate>Wed, 27 Feb 2008 07:59:20 +0000</pubDate>
		<guid isPermaLink="false">http://etbe.coker.com.au/2008/02/27/redirecting-output-from-a-running-process/#comment-12396</guid>
		<description>I very much liked your way of doing things. Note on the TODO is added to try and add that into the package or to replace retty altogether (don't expect that too soon, though..)

Richard</description>
		<content:encoded><![CDATA[<p>I very much liked your way of doing things. Note on the TODO is added to try and add that into the package or to replace retty altogether (don&#8217;t expect that too soon, though..)</p>
<p>Richard</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: etbe</title>
		<link>http://etbe.coker.com.au/2008/02/27/redirecting-output-from-a-running-process/#comment-12395</link>
		<dc:creator>etbe</dc:creator>
		<pubDate>Wed, 27 Feb 2008 07:25:03 +0000</pubDate>
		<guid isPermaLink="false">http://etbe.coker.com.au/2008/02/27/redirecting-output-from-a-running-process/#comment-12395</guid>
		<description>Josh: Thanks for the tip, retty is a very useful program.  It's a pity that they implemented it as an i386 executable instead of a wrapper for GDB (which would have been portable).

However retty does not solve the original problem as it keeps the same controlling terminal.</description>
		<content:encoded><![CDATA[<p>Josh: Thanks for the tip, retty is a very useful program.  It&#8217;s a pity that they implemented it as an i386 executable instead of a wrapper for GDB (which would have been portable).</p>
<p>However retty does not solve the original problem as it keeps the same controlling terminal.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Josh</title>
		<link>http://etbe.coker.com.au/2008/02/27/redirecting-output-from-a-running-process/#comment-12394</link>
		<dc:creator>Josh</dc:creator>
		<pubDate>Wed, 27 Feb 2008 06:12:26 +0000</pubDate>
		<guid isPermaLink="false">http://etbe.coker.com.au/2008/02/27/redirecting-output-from-a-running-process/#comment-12394</guid>
		<description>Nice trick.  I think retty uses the same approach, except that it only supports redirecting to a new tty.

Now if only I could change the UID of a running program.  Often I edit some configuration file or do something else that needs to run as root, but don't realize I ran it as a normal user until after I've put work into it.  While I could certainly save the file somewhere writable and move it in place afterward, I'd love to just sudo-after-the-fact.</description>
		<content:encoded><![CDATA[<p>Nice trick.  I think retty uses the same approach, except that it only supports redirecting to a new tty.</p>
<p>Now if only I could change the UID of a running program.  Often I edit some configuration file or do something else that needs to run as root, but don&#8217;t realize I ran it as a normal user until after I&#8217;ve put work into it.  While I could certainly save the file somewhere writable and move it in place afterward, I&#8217;d love to just sudo-after-the-fact.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
