Ruby
Using Net::HTTP (no dependencies)
require 'net/http' require 'uri' PING_URL = "https://watchcron.com/ping/your-uuid" def ping(url) Net::HTTP.get(URI(url)) rescue => e $stderr.puts "Ping failed: #{e.message}" end ping("#{PING_URL}/start") begin run_backup ping(PING_URL) rescue => e ping("#{PING_URL}/fail") raise end
Rake task
task :cleanup do ping("https://watchcron.com/ping/your-uuid/start") ActiveRecord::Base.connection.execute( "DELETE FROM sessions WHERE updated_at < NOW() - INTERVAL '30 days'" ) ping("https://watchcron.com/ping/your-uuid") end