How to unsuspend process after terminal session closed

Asked by Mannex

I have a shell script running and I ctrl-z to suspend it. Then, I restart the job in the background like %1 &. I later exit that terminal session. The job, of course, is still running. Now, I've opened a new terminal, and I would like to know if there is a way to bring it to the foreground. Since I am in a new terminal session, it is no longer listed as a job in jobs. I have the PID. Any ideas? Thanks.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu gnome-terminal Edit question
Assignee:
No assignee Edit question
Solved by:
Daniel C. Axelrod
Solved:
Last query:
Last reply:
Revision history for this message
marcobra (Marco Braida) (marcobra) said :
#1

Use the

nohup

or

screen

or

byobu

Revision history for this message
Mannex (russ-mannex) said :
#2

thanks for the suggestions. Actually, these sound like great solutions, but not to my problem. I looked at the man pages for each of them and don't see a way to take a process ID of an existing running application and redirect it's output to my current tty. That's, in essence, what I'm trying to do.

Revision history for this message
marcus aurelius (adbiz) said :
#3

did you try what marcobra suggested? or did you just look it up on manpages?

Revision history for this message
Mannex (russ-mannex) said :
#4

I tried various iterations, attempting to manipulate them into doing what I wanted to do. None of them seemed to work.

Revision history for this message
Best Daniel C. Axelrod (daxelrod) said :
#5

AFAIK, even though the process is running, once you've severed its connection to the terminal, there's no way to reconnect it.

You can get around this only if you've initially run the command under screen, nohup, etc. None of those will do any good for an already running process.

Sorry.

Revision history for this message
Mannex (russ-mannex) said :
#6

That was my suspicion, but I wanted to confirm. OK, thanks very much for your answer!