Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require "rubygems"
- require "activerecord"
- require "csv"
- require "ping"
- ActiveRecord::Base.establish_connection(
- :adapter => "mysql",
- :host => "na",
- :username => "na",
- :password => "na",
- :database => "pc_inventory")
- class Computer < ActiveRecord::Base
- end
- Computer.find(:all).each do |computer|
- up = online(computer.ip)
- Computer.update(computer.id, {:online => up})
- end
- def online(host)
- result = Ping.pingecho(host, 2, 445)
- result
- end
Add Comment
Please, Sign In to add comment