#!/usr/local/bin/ruby require 'net/http' require 'time' require 'fileutils' begin Net::HTTP.get_response(URI.parse('http://twitter.com/')).body FileUtils.rm 'index.html' FileUtils.ln_s 'no.html', 'index.html' File.open('log', 'a') do |f| f.write "#{Time.now.xmlschema} no\n" end rescue Exception => e #fail FileUtils.rm 'index.html' rescue nil FileUtils.ln_s 'yes.html', 'index.html' File.open('log', 'a') do |f| f.write "#{Time.now.xmlschema} yes #{e.class}\n" end end