2016-06-10 53 views

回答

4

只需把它作为一个参数:

ssh [email protected] 'cd /projects/rails_project && bundle exec rails c production' 

man ssh

SYNOPSIS 
     ssh [options] [[email protected]]hostname [command] 
     ... 

     If command is specified, it is executed on the remote host instead of a 
     login shell. 
     ... 

     When the user's identity has been accepted by the server, the server 
     either executes the given command in a non-interactive session or, if no 
     command has been specified, logs into the machine and gives the user a 
     normal shell as an interactive session. All communication with the remote 
     command or shell will be automatically encrypted. 
+0

这么想的工作 SSH vgulaev @本地“坎德拉/家/ vgulaev /工作区/ insales_dev/insales && bundle exec rails' bash:bundle:找不到命令 –

+0

'bash:bundle:command not found'你的服务器是否有ssh命令? – andlrc

+0

whereis bundle bundle:/home/vgulaev/.rvm/gems/ruby-2.1.5/bin/bundle –