Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to do

[me@myPc]$ ssh me@server "nohup myBashScript.sh &"

My goal is to launch the process on the server, and then immediately return.

It is not working: The job is started on server, but I still get the output on myPc and bash wait for completion prior to asking me for another command.

Why ? It's not supposed to ! Any way to avoid that ?

  • myPc is RHEL6.2
  • server is ubuntu 10.04 and
  • both runs openssh
share|improve this question

1 Answer 1

up vote 3 down vote accepted

As long as input or output are still open, ssh will keep the connection open. To solve this, make sure the input and output are not open.

For instance, use ssh -n and redirect your output:

ssh -n me@example.com "nohup myscript.sh >/dev/null 2>&1 &"
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.