capturing output from remote servers?

17 views
Skip to first unread message

Vell

unread,
Apr 1, 2014, 4:00:38 PM4/1/14
to capis...@googlegroups.com
Versions:
  • Ruby
  • Capistrano
  • Rake / Rails / etc
Platform:
  • Working on....
  • Deploying to...
Logs:
  • Please past logs (as completely as possible to a 3rd party pasting service such as pastie.org)
Files:
  • Capfile
  • deploy.rb
  • Stage files (production.rb, staging.rb)

Versions:
  • Ruby 2.0.0 p451
  • Capistrano 3.1
  • Rake / Rails / etc Rails 4.0.3
Platform:
  • Working on.... Mac OS X
  • Deploying to... Mac OS X
Logs:
  • Please past logs (as completely as possible to a 3rd party pasting service such as pastie.org)
Files:
  • Capfile
  • deploy.rb
  • Stage files (production.rb, staging.rb)
Hello,

I am having trouble figuring out how to capture the output from remote commands or better yet how to run commands remotely so I can right some conditions in my capistrano deploy.rb file. For instance, One of the things I would like to do is create a file on the remote system if the file doesn't exist.

What is the appropriate way to do this using capistrano? Am I able to just use the Net::SSH commands out of the box? Is there another set of commands I should be looking? Is there a list of commands somewhere?

What I came across in my searches are:


But didn't see any examples of how to capture this to use in my code if its possible.
Some things I have tried are:

execute "ls -al /some/directory"
run "ls -al /some/director
`ssh name@server 'ls -al /some/directory` #this works but I don't feel it is the right way

Sorry if this is such a basic question, I just can't seem to wrap my head around it.
Reply all
Reply to author
Forward
0 new messages