add daemons
This commit is contained in:
parent
30871d0742
commit
fcd37587f2
5 changed files with 43 additions and 1 deletions
3
README
3
README
|
@ -35,4 +35,5 @@ Lots of tests are needed to test the API.
|
|||
|
||||
Lots of little things to make the site work like the old one.
|
||||
|
||||
Also see the 'rails_port' component for bugs on trac.openstreetmap.org
|
||||
Also see the 'rails_port' component for bugs:
|
||||
http://trac.openstreetmap.org/query?status=new&status=assigned&status=reopened&component=rails_port&order=priority
|
||||
|
|
5
config/daemons.yml
Normal file
5
config/daemons.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
dir_mode: script
|
||||
dir: ../../log
|
||||
multiple: false
|
||||
backtrace: true
|
||||
monitor: true
|
19
lib/daemons/gpx_import.rb
Executable file
19
lib/daemons/gpx_import.rb
Executable file
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
#You might want to change this
|
||||
ENV["RAILS_ENV"] ||= "production"
|
||||
|
||||
require File.dirname(__FILE__) + "/../../config/environment"
|
||||
|
||||
$running = true;
|
||||
Signal.trap("TERM") do
|
||||
$running = false
|
||||
end
|
||||
|
||||
while($running) do
|
||||
|
||||
# Replace this with your code
|
||||
ActiveRecord::Base.logger << "This daemon is still running at #{Time.now}.\n"
|
||||
|
||||
sleep 10
|
||||
end
|
15
lib/daemons/gpx_import_ctl
Executable file
15
lib/daemons/gpx_import_ctl
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env ruby
|
||||
require 'rubygems'
|
||||
require "daemons"
|
||||
require 'yaml'
|
||||
require 'erb'
|
||||
require 'active_support'
|
||||
|
||||
options = YAML.load(
|
||||
ERB.new(
|
||||
IO.read(
|
||||
File.dirname(__FILE__) + "/../../config/daemons.yml"
|
||||
)).result).with_indifferent_access
|
||||
options[:dir_mode] = options[:dir_mode].to_sym
|
||||
|
||||
Daemons.run File.dirname(__FILE__) + '/gpx_import.rb', options
|
2
script/daemons
Executable file
2
script/daemons
Executable file
|
@ -0,0 +1,2 @@
|
|||
#!/usr/bin/env ruby
|
||||
Dir[File.dirname(__FILE__) + "/../lib/daemons/*_ctl"].each {|f| `#{f} #{ARGV.first}`}
|
Loading…
Add table
Add a link
Reference in a new issue