3 # You might want to change this
4 # ENV["RAILS_ENV"] ||= "development"
6 require File.dirname(__FILE__) + "/../../config/environment"
10 logger = ActiveRecord::Base.logger
13 ActiveRecord::Base.logger.info("GPX Import daemon wake @ #{Time.now}.")
15 Trace.find(:all, :conditions => { :inserted => false, :visible => true }, :order => "id").each do |trace|
16 Signal.trap("TERM") do
23 if gpx.actual_points > 0
24 Notifier.gpx_success(trace, gpx.actual_points).deliver
26 Notifier.gpx_failure(trace, "0 points parsed ok. Do they all have lat,lng,alt,timestamp?").deliver
29 rescue StandardError => ex
31 ex.backtrace.each { |l| logger.info l }
32 Notifier.gpx_failure(trace, ex.to_s + "\n" + ex.backtrace.join("\n")).deliver
36 Signal.trap("TERM", "DEFAULT")
41 Trace.find(:all, :conditions => { :visible => false }, :order => "id").each do |trace|
42 Signal.trap("TERM") do
48 rescue StandardError => ex
50 ex.backtrace.each { |l| logger.info l }
53 Signal.trap("TERM", "DEFAULT")