2

There is a program that takes unexpectedly long to run. Before I started it, I did not start screen. So I dont know how to detach the process now. Is there any way to keep this process running on background even if I quit the current ssh session without killing it first?

2 Answers 2

1

The typical way to do this is with CTRL-z to suspend the process, and then bg to resume it in the background. Once running as a background process, you can disconnect and it will keep running.

If you need to reattach the process to a terminal later, you can use reptyr, which should be in your distributions repositories.

2
  • Under bg, will the process get killed when the ssh session close? Commented Oct 7, 2015 at 13:28
  • 1
    No, it will keep running in the background. If you disconnect and reconnect you'll be able to see it in the process list.
    – seumasmac
    Commented Oct 7, 2015 at 16:07
0

disown should prevent the shell from sending it a HUP or such on exit of the shell.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .