How to keep program running after logout

Hello everyone.
I am logged into a computer through ssh. I would like to run a program and have it keep running after I log out without screen (i forgot to run it).

For example:

ssh server
user/comp~$ top &
[1] 12021
exit

after that:

ssh server
user/comp~$ (something, maybe shell script) 12021

How can I do that except disown solution?

nohup <script> & 

But you should use nohup before the script had run.

In my case, I just have run ssh, have run application & and exited from session. After that I have run ssh again and "ps aux | grep application" give me it's PID. I would like to attach this application to my new session. That's all.

Check out this link . It might help.

That depends on your OS. AIX's nohup, for instance, can take a PID as argument and disattach the process from the terminal even after the start. This is probably possible in some other OSes too.

I hope this helps.

bakunin

Thanks :slight_smile: At this point in the topic we are talking about Linux. In Linux we don't have -p key in nohup.