HELP - Redirect output of already running process?
Jerry Feldman
gaf at blu.org
Wed Jun 5 17:19:54 EDT 2002
I don't completely understand what you want.
One suggestion is to pipe the output to tee.
Or another is to direct the output to a file, and use tail -f to display
part of it. Using the debugger to redirect during a session has already
been proposed. If you have control of the source code, you can write a
simple signal handler. Send a signal (say USR1) to the application, and it
could toggle the output from stdout to a specific file.
In any case, there are several ways you can keep a running program in the
background when you log out. Daemons do it all the time (double fork, but
there is a bit of magic that you can use to detach it from the process
group).
Since you are multi-threading, you could have one or more threads poll a
file and use that file to control output. (BTW: although it is possible and
legal, I do not recommend using fork() from within a thread).
On 5 Jun 2002 at 14:28, Robert La Ferla wrote:
> Bash Gurus,
>
> Two questions:
>
> I have an important process that is generating a lot of output that I
> need to keep running until it finishes. I need to redirect the output
> to /dev/null or to a file BUT I can't restart the process. I need to do
> this while it is running. I tried a few things with "bg" but it didn't
> quite work.
>
> Secondly, I need to logout yet keep the process running. The process is
> multi-threaded if that matters...
>
> Thanks,
> Robert
>
> _______________________________________________
> Discuss mailing list
> Discuss at blu.org
> http://www.blu.org/mailman/listinfo/discuss
--
Jerry Feldman <gaf at blu.org>
Associate Director
Boston Linux and Unix user group
http://www.blu.org PGP key id:C5061EA9
PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9
More information about the Discuss
mailing list