Skip to content

Instantly share code, notes, and snippets.

@ConstantineXVI
Created July 30, 2013 14:56
Show Gist options
  • Save ConstantineXVI/6113680 to your computer and use it in GitHub Desktop.
Save ConstantineXVI/6113680 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# install the 'net-ping' gem and run
# Ctrl-C quits
require 'net/ping'
running = true
Signal.trap("SIGINT") {|x| running = false}
while running do
p = Net::Ping::HTTP.new('google.com')
p.ping
unless p.ping
puts "#{p.exception} at #{Time.now} \a"
else
puts "success at #{Time.now}"
end
sleep(1)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment