2

I would like to know how I can close an ssh connection to a linux server where I started a process brought to background (by adding & at the end of it) without killing the process.
If I simply do exit, this seems to kill the process.

4
  • 2
    Use GNU Screen gnu.org/software/screen instead of backgrounding a process. Commented Oct 6, 2021 at 17:49
  • 1
    Start the process with nohup and the &. For example, nohup some-long-running-process &. Although as @Nikita Kipriyanov suggested, screen is a much better option. Commented Oct 6, 2021 at 19:23
  • thanks! if you're happy with it please write it as an answer and i'll accept it Commented Oct 8, 2021 at 8:17
  • If your use case is just a one-off job, go with the already proposed solutions. However, if by any chance your use case is to ssh to the server to start an application or service that will run continuously, you may want to look at a systemd service. Commented Oct 19, 2021 at 18:38

1 Answer 1

2

from the comments: Start the process with nohup and the &. For example, nohup some-long-running-process &. Although as @Nikita Kipriyanov suggested, GNU screen https://www.gnu.org/software/screen/ is a much better option.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.