Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

As followup of this question, I would like to know where the STDOUT and STDERR of a program on which I've run disown -h is redirected to.

share|improve this question
add comment

1 Answer

up vote 7 down vote accepted

disown does not change the programs STDOUT/ERR. They will still go to wherever you redirected them (using > etc.). If you did not redirect them, they'll continue to go into the terminal you started the program from (until you close that terminal, in which case they'll be discarded).

To illustrate, run this in a terminal:

bash -c 'while true; do sleep 1; echo hi; done' &

This will print "hi" every second (and annoy you terribly ;-)). If you disown the program after start, the "hi"s will just continue. You need to find the shell's PID (using e.g. ps) and kill it to make it stop.

Edit:

Based on the comments, maybe what you really want to do is to recover the output of the program after you disowned it and closed the terminal it was running in. This is explained in this question: http://superuser.com/questions/50058/after-the-fact-remote-nohup-with-tcsh/50077#50077 (thanks to quack quixote).

share|improve this answer
    
According to his previous question, the fact is that he closed this previous terminal. How can he get the output, then? –  Gnoupi Mar 29 '10 at 9:39
    
@Gnoupi: I don't think there's any way to get the output back. At least I've never heard of any way. –  sleske Mar 29 '10 at 9:43
    
Thanks for the comment Gnoupi :-) In facts, the output is nowhere to be found. I'll keep looking though :-) –  Thrawn Mar 29 '10 at 9:45
1  
this really is the answer: disown doesn't change anything; you need to setup any capture or redirection when you start the process. if you need it afterwards, gdb is your (only) friend: superuser.com/questions/50058/… –  quack quixote Mar 29 '10 at 9:48
    
@quack - I would say that the question needs refactoring, then, to emphasize on the actual use case, rather than only the tool. In the current form (centered on disown), this is indeed the correct answer. But from the context, with the previous question, the user wants simply to recover the output, and in this case your link is the answer. –  Gnoupi Mar 29 '10 at 10:01
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.