S
S
Sergey Rogozhkin2011-03-09 16:49:23
linux
Sergey Rogozhkin, 2011-03-09 16:49:23

Linux: reattach console to process?

Business was from under ssh in bash.
I ran some program for several days, which occasionally prints messages to standard output. Then I did
Ctrl-Z
$ bg
$ logout
The next day I logged in again and see the program in the list of processes. Still working, damn it.
Is it possible to attach the output of the program back to the console / see its output?
If so, how?
PS/ I understand that if I had done something like “progname | tee ./log-file", then this question could have been avoided, but the process cannot be interrupted.
UPD: after re-login, jobs does not hang, unfortunately.

Answer the question

In order to leave comments, you need to log in

6 answer(s)
3
3vi1_0n3, 2014-10-10
@thecoder

The question is 3 years old already, however:

reptyr is a utility for taking an existing running program and
attaching it to a new terminal, and is particularly useful for moving
a long-running process into a GNU screen session.

S
Sliver, 2011-03-09
@Sliver

At the first attempt to output something to the logged-out terminal, the program will end with SIGHUP (unless, of course, it specifically processes this signal and is not launched via nohup).
Therefore, judging by the fact that she is still working, she has not yet tried to deduce anything.
Perhaps this will give some hint on the topic of what she is thinking about there.

S
StopDesign, 2011-03-09
@StopDesign

If the process is hanging in jobs, then fg %1 (or whatever). If it doesn't, then I don't know.

V
Vlad Frolov, 2011-03-09
@frol

If you have root permissions: strace -ewrite -p $PID

P
Puma Thailand, 2011-03-09
@opium

Run applications in screen
and then ctrl+a+d

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question