tags:

views:

435

answers:

5

I have done this to that programe: ctrl-z disown -h %1 bg 1

then logout,

Is it still possible for me to see what that programe outputs to stdout now?

A: 

Not if you've logged out. The process will be writing stdout to the pty that was allocated on login, and logging out will remove this allocation. You'll have to redirect the stdout to a file, and then tail that.

Brian Agnew
I have the root priviledge,will it help?
Shore
It's not a privilege issue. It's an issue of streams being closed off upon logout
Brian Agnew
+1  A: 

Don't know if it will help you, but you could call "gdb" and change the file descriptor. See http://blog.tridgell.net/?p=4

coredump
+1  A: 

General screen usage:

user@machine:/home/user$ screen bash -l
user@machine:/home/user$ long_running_program
<user presses ctrl-a d to detach from the screen session>
user@machine:/home/user$ screen -ls
There is a screen on:
        58356.ttys000.machine     (Detached)
1 Socket in /tmp/uscreens/S-user.
user@machine:/home/user$ screen -r 58356
<user is connected to the original screen session>
Chas. Owens
Screen is a way to go.. Or nohup
rasjani
A: 
ctrl-z the program
bg %  so it wont die when you logoff
screen retty $Pid
will attach the running program into screen

duplicate question of http://stackoverflow.com/questions/1006885

mog
A: 

This should be possible..

Yes, this is an old question, but I'm sure others have been in the same position. This gentleman's gdb script wizardry allows one to "repoint" file descriptors in running processes. It can be done per-process by PID, or will call fuser to find all processes using the file. I also just confirmed it works on /dev/pty/*, so STD(IN,OUT,ERR) are possible as well.

http://groups.google.com/group/alt.hackers/browse_thread/thread/d1932c31ce43bd4c

.

Same as the answer I posted here: http://stackoverflow.com/questions/1006885/how-to-replace-the-disown-with-screen/3654324#3654324

phreakocious