Solved

Expect for Ruby

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

774 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