0

I use GOD to watch the process => rake resque:scheduler

Before run 'rake resque:scheduler ' I have to run rake resque_schedule:setup

But the following settings are not working.

I use the ps aux to list the process but the scheduler is not working as I expect.

It should generate tasks periodically.

If I type the 2 commands in shell, it works.

I have no ideas

God.watch do |w|


  system("rake resque_schedule:setup ") # run the rake to load environment

  w.name = 'resque-scheduler'
  w.interval = 5.seconds
  w.dir = File.expand_path(File.join(File.dirname(__FILE__),'..'))
  # w.start = "rake resque_schedule:setup ; rake resque:scheduler "
  w.start = "rake resque:scheduler "
  w.start_grace = 10.seconds
  w.log = File.expand_path(File.join(File.dirname(__FILE__), '.','log','resque-scheduler.log'))
  w.keepalive(:memory_max => 150.megabytes,
              :cpu_max => 50.percent)


end
newBike
  • 14,385
  • 29
  • 109
  • 192
  • why `system` command ? If you want to load the environment can that be done in simply way like `rake environment resque:scheduler` – Viren Dec 04 '13 at 09:24

1 Answers1

0

You should call rake resque_schedule:setup before god.start call.

For example:

system("rake resque_schedule:setup")
god.start
Amit Thawait
  • 4,862
  • 2
  • 31
  • 25