Thanks for your answer. Well, my '~/.bashrc' file is the standard default one. I just added an 'echo' command in order for me to be informed when this file is launched (That's usefull indeed !).
Simple question : How the capistrano's community would know that Capistran's current release 3.0.1 doesnt deactivate PTY by default when the official doc (the link you gave) and the readme https://github.com/capistrano/capistrano/blob/master/README.md clearly stated that it does ? Moreover the Changelog https://github.com/capistrano/capistrano/blob/master/CHANGELOG.md doesn't says anything about a change with pty default value. I also notice that the 'deploy_to' variable defaulted to /var/www, instead of /var/www/#{fetch(:application)}. Maybe this is a desired working, I don't know. At least, I know I will never anymore rely on default settings ;o) This is my new deploy.rb : require 'rvm/capistrano' set :rvm_type, :system set :application, 'odpf' set :repo_url, '[email protected]:mycount/mygitrepo.git' set :branch, 'production_1.01' set :deploy_to, '/var/www/odpf' set :pty, false set :scm, :git set :format, :pretty namespace :deploy do desc 'Restart application' task :restart do on roles(:app), in: :sequence, wait: 5 do # Your restart mechanism here, for example: # http://www.modrails.com/documentation/Users%20guide%20Apache.html#_redeploying_restarting_the_ruby_on_rails_application execute :touch, release_path.join('tmp/restart.txt') end end after :restart, :clear_cache do on roles(:web), in: :groups, limit: 3, wait: 10 do # Reference : http://guides.rubyonrails.org/v3.2.14/command_line.html#tmp within release_path do execute :rake, 'tmp:cache:clear' end end end after :finishing, 'deploy:cleanup' end So I tried to set(:pty, false) with Capistrano 3.0.1. I also tried with master branch Capitrano 3.1.0. In both case Capistrano "*seems*" to be running a non-login interactive connexion because my echo command still appear in the capistrano output (so ~/.bahsrc file is read). I can't figure ot why. To check that I created two task based on your advice ( http://capistranorb.com/documentation/faq/why-does-something-work-in-my-ssh-session-but-not-in-capistrano/ ) : desc "Check if ssh connexion is interactive" task :query_interactive do on roles(:all) do |host| info capture("[[ $- == *i* ]] && echo 'Interactive' || echo 'Not interactive'") + " on #{host}" end end desc "Check if ssh connexion is Login shell" task :query_login do on roles(:all) do |host| info capture("shopt -q login_shell && echo 'Login shell' || echo 'Not login shell'") + " on #{host}" end end The result is that it is : *Not Interactive* and *Not login shell* though ~/.bashrc is read each time ! ^^ douglas@bilbo:/var/www/odpf$ bundle exec cap production test_odpf: query_login DEBUG [92119b95] Running /usr/bin/env shopt -q login_shell && echo 'Login shell' || echo 'Not login shell' on phisa-odpf-vd.vserver.nimag.net DEBUG [92119b95] Command: shopt -q login_shell && echo 'Login shell' ||echo 'Not login shell' DEBUG [92119b95] === Lancement de /home/rvm_admin/.bashrc === DEBUG [92119b95] Not login shell DEBUG [92119b95] Finished in 0.638 seconds with exit status 0 (successful). INFO === Lancement de /home/rvm_admin/.bashrc === *Not login shell on myserver.**net* douglas@bilbo:/var/www/odpf$ douglas@bilbo:/var/www/odpf$ bundle exec cap production test_odpf: query_interactive DEBUG [1275aad9] Running /usr/bin/env [[ $- == *i* ]] && echo 'Interactive' || echo 'Not interactive' on phisa-odpf-vd.vserver.nimag.net DEBUG [1275aad9] Command: [[ $- == *i* ]] && echo 'Interactive' || echo 'Not interactive' DEBUG [1275aad9] Finished in 0.617 seconds with exit status 0 (successful). DEBUG [1275aad9] === Lancement de /home/rvm_admin/.bashrc === DEBUG [1275aad9] Not interactive DEBUG [1275aad9] Finished in 0.617 seconds with exit status 0 (successful). INFO === Lancement de /home/rvm_admin/.bashrc === *Not interactive on myserver.net* There is something weird going on here and I don't know why ??? Le mardi 14 janvier 2014 12:16:47 UTC+1, Lee Hambley a écrit : > > First up, try this: > http://capistranorb.com/documentation/faq/why-does-something-work-in-my-ssh-session-but-not-in-capistrano/ > Some > of the content towards the end of that page is important. > > The output === Lancement de /home/rvm_admin/.bashrc === indicates that > you have something loading, which shouldn't. We have always recommended > against using a pty especially as we can't guarantee what happen in those > scripts, and how it might break your environment in the scripting context. > > If you don't want to use a PTY (see below, for why you need the > workaround) simply add set(:pty, false) somewhere early in your code. > Along with the other set() lines is early enough. > > It looks like you are using a version of Capistrano which still defaulted > to using a pty by default (a mistake on our side) I suggest you try > upgrading, and using Capistrano from master until we throw out the new > release which certainly has that corrected, although any revision after > 3.0.1 (from the Git history) should be fine. > > I can't explain why your ssh session is timing out, but whatever your > .bashrc is doing is certainly not helping. > > Lee Hambley > >> >> -- You received this message because you are subscribed to the Google Groups "Capistrano" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web, visit https://groups.google.com/d/msgid/capistrano/516fa71c-f42a-462b-a837-8045bfd776f6%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
