我在deploy deploy.rb文件中有这个任务:
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
当我运行此任务时,它所做的就是挂起。尽管有-f
参数,它仍然不会退出。
如何退出此任务,以便继续使用capistrano?
答案 0 :(得分:0)
我从capistrano的execute
切换到ruby的system
命令。
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