Guest User

Untitled

a guest
Mar 11th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. require "rubygems"
  2. require "activerecord"
  3. require "csv"
  4. require "ping"
  5.  
  6. ActiveRecord::Base.establish_connection(
  7. :adapter => "mysql",
  8. :host => "na",
  9. :username => "na",
  10. :password => "na",
  11. :database => "pc_inventory")
  12.  
  13. class Computer < ActiveRecord::Base
  14. end
  15.  
  16. Computer.find(:all).each do |computer|
  17. up = online(computer.ip)
  18. Computer.update(computer.id, {:online => up})
  19. end
  20.  
  21. def online(host)
  22. result = Ping.pingecho(host, 2, 445)
  23. result
  24. end
Add Comment
Please, Sign In to add comment