abhinavkulkarni
abhinavkulkarni

Reputation: 2409

Unable to retrieve nohup process using fg

I was running a process from terminal in an SSH session and started the process in background with nohup and disconnected.

After some time I log back on the server and see that process is still running but cannot bring it back to foreground with current bash terminal since it was not the one which started it. I think the process now belongs to init as the shell which started the process exited when I exited from the first SSH session.

Now, how do I interact the process that I started? I mean it's not that I want to kill it or something, but what if the process takes user input from time to time and now it's waiting for one?

Upvotes: 0

Views: 1222

Answers (1)

Celada
Celada

Reputation: 22261

Now, how do I interact the process that I started?

Short answer: you don't. That process' input and output are connected to a terminal that doesn't exist anymore.

What if the process takes user input from time to time and now it's waiting for one?

It won't be waiting for input. If it had tried to get any, it would have received an end-of-file when it tried to read.

Perhaps you would prefer to run such a process under screen so that you can detach the session and reattach it.

Upvotes: 2

Related Questions