Created
June 24, 2009 01:33
-
-
Save mccxj/134952 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 因为使用ssh2的时候,总是出错,所以改用ssh1 | |
require 'rubygems' | |
gem 'net-ssh', '1.1.4' | |
require 'net/ssh' | |
# 用来更新32和63的ruby小脚本 | |
cmd = Proc.new do |shell| | |
shell.cd("/opt/gst") | |
print "current directory:",shell.pwd.stdout | |
print "current ruby version:",shell.ruby("-v").stdout | |
print shell.sh("/opt/getupdate.sh").stdout | |
shell.exit | |
end | |
Net::SSH.start('192.168.1.32', :username => 'root', :password=>'psword') do |session| | |
shell = session.shell.sync | |
cmd.call(shell) | |
p "192.168.1.32 done!" | |
end | |
Net::SSH.start('192.168.1.63', :username => 'root', :password=>'psword') do |session| | |
shell = session.shell.sync | |
cmd.call(shell) | |
p "192.168.1.63 done!" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment