Ruby is so elegant


This is a script to log in to a server via Telnet and run a single script remotely.


require 'net/telnet.rb'

myserver.com = Net::Telnet::new("Host" => "myserver.com",
"Timeout" => 30,
"Prompt" => /[$%#] z/n)

myserver.com.login("username", "password") { |c| print c }
myserver.com.close
myserver.com.cmd("./check_missing.sh") { |c| print c }

Leave a Reply

%d bloggers like this: