Where is the STDOUT of a disowned program directed to?
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.
Solution 1:
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 disown
ed it and closed the terminal it was running in. This is explained in this question: After-the-fact remote nohup with tcsh (thanks to quack quixote).