Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to see output to stdout after disown and logout?

Tags:

linux

bash

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?

like image 803
omg Avatar asked Jun 17 '09 12:06

omg


4 Answers

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 how to replace the "disown" with "screen"?

like image 50
mog Avatar answered Oct 07 '22 09:10

mog


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>
like image 21
Chas. Owens Avatar answered Oct 07 '22 09:10

Chas. Owens


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

like image 35
coredump Avatar answered Oct 07 '22 10:10

coredump


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: how to replace the "disown" with "screen"?

like image 42
phreakocious Avatar answered Oct 07 '22 11:10

phreakocious