3

You already have a running process and you want to put it to run in background.

If you want to be sure that this will still run after you close you ssh connection, what should you do?

Note: you are already running the process at the time you want to make this decision.

I know that Ctrl-Z and bg will make it run in background, still I am afraid that the process will be killed when you close the ssh connection.

sorin
  • 7,668
  • 24
  • 75
  • 100

1 Answers1

6

Just type disown, it is a bash builtin

Without options, each jobspec is removed from the table of active jobs. If the -h option is given, each jobspec is not removed from the table, but is marked so that SIGHUP is not sent to the job if the shell receives a SIGHUP. If no jobspec is present, and neither the -a nor the -r option is supplied, the current job is used. If no jobspec is supplied, the -a option means to remove or mark all jobs; the -r option without a jobspec argument restricts operation to running jobs. The return value is 0 unless a jobspec does not specify a valid job.

From the scratch, you will do like this

- <command> & #make it run in background
- disown #make it run even if your ssh session disconnect
cuonglm
  • 2,346
  • 2
  • 15
  • 20