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 = 0 and visible = 1", :order => "id").each do |trace|
16 Signal.trap("TERM") do
23 if gpx.actual_points > 0
24 Notifier::deliver_gpx_success(trace, gpx.actual_points)
27 Notifier::deliver_gpx_failure(trace, '0 points parsed ok. Do they all have lat,lng,alt,timestamp?')
29 rescue Exception => ex
31 ex.backtrace.each {|l| logger.info l }
33 Notifier::deliver_gpx_failure(trace, ex.to_s + "\n" + ex.backtrace.join("\n"))
36 Signal.trap("TERM", "DEFAULT")
41 Trace.find(:all, :conditions => "visible = 0", :order => "id").each do |trace|
42 Signal.trap("TERM") do
48 rescue Exception => ex
50 ex.backtrace.each {|l| logger.info l }
53 Signal.trap("TERM", "DEFAULT")