Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 6 down vote accepted

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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.