Permalink
Browse files

fix some problems with the daemon template that stop it from working …

…out of the box
  • Loading branch information...
1 parent f761b90 commit 2e82e23a934caa94f186492404fa448002158b58 @look committed Jul 5, 2007
Showing with 6 additions and 8 deletions.
  1. +6 −8 generators/fetcher_daemon/templates/daemon
@@ -1,17 +1,14 @@
#!/usr/bin/env ruby
-require File.dirname(__FILE__) + '/../config/boot'
-require 'daemon'
-require 'yaml'
-require 'fetcher'
+require File.dirname(__FILE__) + '/../config/environment.rb'
class <%=class_name%>FetcherDaemon < Daemon::Base
- @config = YAML.load_file("#{RAILS_ROOT}/config/<%=file_name%>_fetcher.yml")
+ @config = YAML.load_file("#{RAILS_ROOT}/config/<%=file_name%>.yml")
@config = @config[RAILS_ENV].to_options
- @sleep_time = @config.delete(:sleep_time)
+ @sleep_time = @config.delete(:sleep_time) || 60
def self.start
- puts "Starting <%=class_name%>Fetcher"
+ puts "Starting <%=class_name%>FetcherDaemon"
# Add your own receiver object below
@fetcher = Fetcher.create({:receiver => nil}.merge(@config))
@@ -22,8 +19,9 @@ class <%=class_name%>FetcherDaemon < Daemon::Base
end
def self.stop
- puts "Stopping <%=class_name%>Fetcher"
+ puts "Stopping <%=class_name%>FetcherDaemon"
end
end
+<%=class_name%>FetcherDaemon.daemonize

0 comments on commit 2e82e23

Please sign in to comment.