[Novalug] redirecting stdout of a running process (and another interesting usage of gdb)

Mark Smith mark@winksmith.com
Thu May 27 19:42:23 EDT 2010


apropos, but opposite to your problem... this has always been a
useful technique for temporary files.  sometimes it's hard to delete
a temporary file.  you have to catch interupts and then do an unlink.
in some cases you just can't catch all conditions (e.g. kill -9 or
a power hit).

you can create a file and then unlink it.   as long as you keep the
file descriptor open, the file exists, but no longer has a name.
once the program exits the kernel then releases the resources associated
with it.  you don't have to remember to delete anything.  the system
is self cleaning.

kind of cool if you need that kind of functionality.

On Thu, May 27, 2010 at 03:08:58PM -0400, Doug Toppin wrote:
> I ran across an interesting situation today that I thought I would pass along.
> If you have a running process that has had stdout sent to a file and
> you accidentally remove the file by mistake you may not get any more
> output from the process to it.  Restarting the process may be
> necessary to get the output going to a file that you can see again
> (but restarting it may be undesirable).
...

-- 
Mark Smith
mark@winksmith.com
mark@tux.org



More information about the Novalug mailing list