Pergunta

I have this task in may deploy.rb file:

desc 'open ssh session in background'
  task :ssh_in_background do

    run_locally do 
      execute "ssh -o 'ExitOnForwardFailure yes' -NMS ~/.ssh-tunnel -f #{fetch(:rails_env)}-#{fetch(:application)}"
      execute "exit" 
    end
  end

When I run this task, all it does is hang. It never quits despite the -f parameter.

How do I make this task exit so that capistrano will continue on?

Foi útil?

Solução

I switched from capistrano's execute to ruby's system command.

desc 'open ssh session in background'
  task :ssh_in_background do

    run_locally do 
      system "ssh -o 'ExitOnForwardFailure yes' -NMS ~/.ssh-tunnel -f #{fetch(:rails_env)}-#{fetch(:application)}"
    end
  end
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top