在disown和logout之后是否可以看到输出到stdout?

时间:2021-06-10 01:18:19

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

我已经完成了这个程序:ctrl-z disown -h%1 bg 1

then logout,

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

我现在还能看到这个程序输出到stdout吗?

5 个解决方案

#1


2  

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>

#2


1  

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

不知道它是否会对你有所帮助,但你可以调用“gdb”并更改文件描述符。见http://blog.tridgell.net/?p=4

#3


1  

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"?

重复的问题,如何用“屏幕”取代“disown”?

#4


1  

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.

是的,这是一个老问题,但我确信其他人也处于相同的位置。这位绅士的gdb脚本魔法允许在运行的进程中“重新指定”文件描述符。它可以通过PID按进程完成,或者调用fuser来查找使用该文件的所有进程。我也刚刚确认它适用于/ dev / pty / *,因此STD(IN,OUT,ERR)也是可行的。

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"?

与我在这里发布的答案相同:如何用“屏幕”替换“disown”?

#5


0  

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.

如果您已退出,请勿使用。该过程将stdout写入登录时分配的pty,并且注销将删除此分配。你必须将stdout重定向到一个文件,然后尾随它。

#1


2  

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>

#2


1  

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

不知道它是否会对你有所帮助,但你可以调用“gdb”并更改文件描述符。见http://blog.tridgell.net/?p=4

#3


1  

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"?

重复的问题,如何用“屏幕”取代“disown”?

#4


1  

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.

是的,这是一个老问题,但我确信其他人也处于相同的位置。这位绅士的gdb脚本魔法允许在运行的进程中“重新指定”文件描述符。它可以通过PID按进程完成,或者调用fuser来查找使用该文件的所有进程。我也刚刚确认它适用于/ dev / pty / *,因此STD(IN,OUT,ERR)也是可行的。

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"?

与我在这里发布的答案相同:如何用“屏幕”替换“disown”?

#5


0  

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.

如果您已退出,请勿使用。该过程将stdout写入登录时分配的pty,并且注销将删除此分配。你必须将stdout重定向到一个文件,然后尾随它。