Skip to content

Instantly share code, notes, and snippets.

@Tho85
Created April 30, 2013 11:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tho85/5488109 to your computer and use it in GitHub Desktop.
Save Tho85/5488109 to your computer and use it in GitHub Desktop.
# Start SSH session on first available server
task :ssh do
hostname = find_servers_for_task(current_task).first
exec %Q|ssh -l #{user} #{hostname} -t '#{default_shell}'|
end
# Start Rails console on first available server
namespace :rails do
task :console, :roles => :app do
hostname = find_servers_for_task(current_task).first
exec %Q|ssh -l #{user} -p #{ssh_options[:port] || 22} #{hostname} -t 'bash -l -c "cd #{current_path} && bundle exec rails console #{rails_env}"'|
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment