Hello there,

quick Q: I am using delayed_job in a project of mine and try watching
it with god. God actually does start it perfectly fine, but
delayed_job never leaves the 'init' phase and whenever I do a god
terminate, god doesn't terminate the dj instance.

Does anyone know what I could do or what's wrong with the config
below? Or alternatively.. how do you monitor a (vanilla) delayed_job
instance?

Cheers & thanks,
-J


Config:


RAILS_ROOT = "/home/rails/sexwise/current"

God.watch do |w|
  w.name = "delayed_job_worker"
  w.interval = 30.seconds

  w.pid_file = File.join(RAILS_ROOT, "tmp/pids/
delayed_job_worker.pid")

  w.start = "rake -f #{RAILS_ROOT}/Rakefile jobs:work
RAILS_ENV=production"
  w.stop = "kill -9 `cat #{w.pid_file}`"

  w.uid = "rails"
  w.gid = "rails"

  # retart if memory gets too high
  w.transition(:up, :restart) do |on|
    on.condition(:memory_usage) do |c|
      c.above = 256.megabytes
      c.times = 2
    end
  end

  # determine the state on startup
  w.transition(:init, { true => :up, false => :start }) do |on|
    on.condition(:process_running) do |c|
      c.running = true
    end
  end

  # determine when process has finished starting
  w.transition([:start, :restart], :up) do |on|
    on.condition(:process_running) do |c|
      c.running = true
      c.interval = 5.seconds
    end

    # failsafe
    on.condition(:tries) do |c|
      c.times = 5
      c.transition = :start
      c.interval = 5.seconds
    end
  end

  # start if process is not running
  w.transition(:up, :start) do |on|
    on.condition(:process_running) do |c|
      c.running = false
    end
  end
end
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"god.rb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/god-rb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to