What's the difference between ssh remote command and capistrano run?

208 views
Skip to first unread message

赵 耀

unread,
May 21, 2012, 6:13:27 AM5/21/12
to Capistrano
I use capistrano to deploy my java app which is deployed to a resin server.
When I use
run "/path/to/resin/bin/httpd.sh restart"
I just got logs said the server was shuting down, but the server was never started.

But when I use
ssh $host "/path/to/resin/bin/httpd.sh restart"
from command line, it works just fine.

So what is the difference?




Best regards.

Rob Hunter

unread,
May 21, 2012, 11:41:23 AM5/21/12
to capis...@googlegroups.com

There are a few differences.

`cap run httpd` works very much like `ssh host httpd` but it differs in a few ways:

It doesn't claim to be an interactive terminal. Anything that behaves differently for interactive use and non-interactive use will use the non-interactive behavior for Capistrano.

By default, `sudo` asks for passwords on interactive terminals but never tries asking a non-terminal. Check your security logs to see if this is happening to you.

Capistrano doesn't use the `ssh` command under the covers -- Capistrano uses the Ruby library `Net::SSH` instead of the C OpenSSH code.

If your SSH configuration uses some of OpenSSH more advanced features (like proxies or X11 forwarding) they may not work the same under Ruby's Net::SSH.

A useful debugging trick: compare the results of `ssh myhost env` against the results of `cap run env`. That will show any differences in environment variables.

Likewise, you can compare the results of `whoami` or `pwd`. If everything is still the same, running something with `sudo`.

Good luck finding the difference!

--
Rob Hunter
(typed with my thumbs)

--
* You received this message because you are subscribed to the Google Groups "Capistrano" group.
* To post to this group, send email to capis...@googlegroups.com
* To unsubscribe from this group, send email to capistrano+...@googlegroups.com For more options, visit this group at http://groups.google.com/group/capistrano?hl=en
Reply all
Reply to author
Forward
0 new messages