?
Solved

Expect for Ruby

Posted on 2008-10-17
3
Medium Priority
?
1,242 Views
Last Modified: 2012-08-14
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
Comment
Question by:aguiarrj
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 14

Accepted Solution

by:
wesgarrison earned 252 total points
ID: 22746996
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
 
LVL 10

Assisted Solution

by:Andrew Doades
Andrew Doades earned 248 total points
ID: 22825519
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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently rediscovered rails when I needed a holiday project and decided to build a management dashboard for the company where I work.  With it being a project done in my free time, I could focus my time on learning the basics rather than trying to…
Recently I spent hours debugging an issue in a Rails project where ActiveRecord was causing MySQL errors trying to create a User object of a class at the top level of a Single Table Inheritance model structure.  It turns out `.create` behaves differ…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question