omaciel/robottelo — pull request #1313 by elyezer (2014-09-08 11:47:58+00:00)
Title: Start ssh tunnel in background

Starting ssh in background mode ensure that exec_command will return.

There are some points do discuss:

1. With this change the tunnel will be active until the machine restarts, do we need something that runs forever or do we need something that runs until the Proxy exists?
2. We can use `nohup` [1], but I don't get a good result using it. There is also the bash built in `disown` but I have not tested it, because it is not straight forward.
4. Tried using `dtach` and worked better but don't figured out a way to kill the tunnel later (maybe need to query ps to get the pid)
5. A better approach is to create a real daemon so we can start and stop as needed as recommended by the fabric docs [3]

Have sent the PR so we can discuss and make an agreement on the approach that we will use.

[1] http://en.wikipedia.org/wiki/Nohup

[2] http://stackoverflow.com/questions/8775598/start-a-background-process-with-nohup-using-fabric

[3] http://www.fabfile.org/faq.html#why-can-t-i-run-programs-in-the-background-with-it-makes-fabric-hang