Skip to content

Instantly share code, notes, and snippets.

View arctickiwi's full-sized avatar

Jonathon Horsman arctickiwi

View GitHub Profile
@arctickiwi
arctickiwi / connection_test.rb
Last active February 25, 2016 16:30
Long-running task which periodically checks the internet connection by pinging Google's DNS server and reporting outages
require 'net/ping'
HOST = '8.8.4.4'
start = Time.now
puts "#{start} Starting connection check. Pinging #{HOST}"
icmp = Net::Ping::ICMP.new(HOST)
@down = false
total = 0