• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1263
  • Last Modified:

Expect for Ruby

Hi everyone,

I've been assigned the task of automating one of our applications' intallation. One of the requirements is that this "automation script" should reside on a centralized location and should be able to remote connect to different boxes and run the installation package in each of them (via ssh for example). We want this script to work on UNIX.

I'm planning on learning Ruby to do this :-) The question I have is, do I need expect to automate the SSH connection so the user doesn't have to put in the usr and pwd? or ruby does that in the parameters of function that opens an ssh connection?

Many thanks in advance
0
aguiarrj
Asked:
aguiarrj
2 Solutions
 
wesgarrisonCommented:
This totally doesn't answer your question about rExpect, but have you looked at capistrano (www.capify.org)?

Simply put, Capistrano is a tool for automating tasks on one or more remote servers. It executes commands in parallel on all targeted machines, and provides a mechanism for rolling back changes across multiple machines. It is ideal for anyone doing any kind of system administration, either professionally or incidentally.
It's pretty handy for automation and remote deployments.  Basically, you supply commands and it'll wrap them in an SSH session and execute them on the remote server.

0
 
Andrew DoadesIT TechnicianCommented:
see attached, you will need to run   gem install net-ssh

the below will login to the server and create myfile
You can alter this to ./myfile  to execute your file
require 'rubygems'
require 'net/ssh'
 
 
Net::SSH.start( 'server_name/ipaddress',
                :username=>'myuser',
                :password=>'mypass' ) do |session|
 
session.open_channel do |channel|
      channel.on_data do |ch, data|
        puts data
      end
      channel.exec 'touch myfile'
    end
    session.loop
end

Open in new window

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now