Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

HELP - Redirect output of already running process?



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





BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org