Solved

Expect for Ruby

Posted on 2008-10-17
3
1,230 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 63 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 62 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Article by: narshlob
If you've ever programmed in Ruby and have come across either a proc or a lambda, you might have been wondering what the difference is between the two and when you would use one over the other. This article will try to explain the difference between…
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…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

728 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