Created
October 4, 2012 16:37
-
-
Save andrewzimmer906/3834824 to your computer and use it in GitHub Desktop.
Daemons
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# You might want to change this | |
ENV["RAILS_ENV"] ||= "daemon" | |
require File.dirname(__FILE__) + "/../../config/application" | |
#require 'rubygems' | |
Rails.application.require_environment! | |
$running = true | |
Signal.trap("TERM") do | |
$running = false | |
end | |
while($running) do | |
account = Account.find(1) | |
#Rails.logger.info "account = #{account}" | |
# Replace this with your code | |
Rails.logger.auto_flushing = true | |
Rails.logger.info "This daemon is still running at #{Time.now}.\n" | |
sleep 1 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment