Daemons ... this should be simple

Hey everyone,

I have a very (hopefully) dumb question about running daemons with the
daemons gem. This is my set up (using strictly the code from the daemons
API page):

myserver.rb

loop do
sleep(5)
end

myserver_control.rb

require ‘rubygems’
require ‘daemons’

Daemons.run(‘myserver.rb’)

THEN I typed this into the console:

ruby script/runner myserver.rb

and THIS is the ERROR I got:

F:\InstantRails\rails_apps\vote>ruby script/runner myserver.rb
F:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/runner.rb:4
7: undefined local variable or method myserver' for main:Object (NameError) from F:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require .rb:27:ineval’
from
F:/InstantRails/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/command
s/runner.rb:47
from
F:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require
.rb:27:in gem_original_require' from F:/InstantRails/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require .rb:27:inrequire’
from script/runner:3

Dumb question 1: What am I doing wrong?
Dumb question 2: These files are supposed to be in the root of the tasks
folder correct?

Thanks in advance,
Brandon

My first impression is that you should be using the full path to the
myserver.rb file … if myserver.rb is in lib/tasks, then you should run
ruby
script/runner lib/tasks/myserver.rb. -J.
On Wed, Aug 13, 2008 at 5:16 PM, Brandon G. <

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs