Heroku Task

language: Ruby
license: Other

Code for Snippet:

                
touch lib/tasks/ping.rake
 
 
 
 
 
 
require 'net/http'
 
namespace :ping do
  desc "Ping our heroku dyno every 10, 60 or 3600 min"
  task :start do
    puts "Making the attempt to ping the dyno"
 
    if ENV['URL']
      puts "Sending ping"
 
      uri = URI(ENV['URL'])
      Net::HTTP.get_response(uri)
 
      puts "success..."
    end
  end
end
 
 
 
 
heroku run rake ping:start
comments powered by Disqus

Info

Link to this snippet:


Download to Code Collector

To use the direct link to your snippet on CodeCollector.net either copy the html from the above section or drag the Download to Code Collector to where you would like to use it.

More Info:

Times Viewed: 3
Date Added: 2017-06-26 22:57:17
Last Modified: 2017-07-22 02:07:04

Web Analytics