Does anyone have a working setup where god is starting and monitoring
backgroundrb? I have a site running on OS X Tiger, with lots of
components, and God is doing a great job and giving me lots of piece
of mind, but for whatever reason, it can't execute backgroundrb/start
properly. It seems like it can't run the backgroundrb start script,
though I verified that it works locally. The log file shows:
I, [2008-01-29T12:56:55.580572 #70] INFO -- : backgroundrb move
'unmonitored' to 'init'
I, [2008-01-29T12:56:56.122592 #70] INFO -- : backgroundrb [trigger]
backgroundrb God::Conditions::ProcessRunning: no such pid file: /
Volumes/OtherInboxDev/otherinbox/shared/log/backgroundrb.pid
(ProcessRunning)
I, [2008-01-29T12:56:56.191987 #70] INFO -- : backgroundrb move
'init' to 'start'
I, [2008-01-29T12:56:56.196883 #70] INFO -- : backgroundrb
before_start: no pid file to delete (CleanPidFile)
I, [2008-01-29T12:56:56.202412 #70] INFO -- : backgroundrb start: /
Volumes/OtherInboxDev/otherinbox/current/script/backgroundrb start
I, [2008-01-29T12:57:13.414195 #70] INFO -- : backgroundrb [ok]
backgroundrb God::Conditions::ProcessRunning: no such pid file: /
Volumes/OtherInboxDev/otherinbox/shared/log/backgroundrb.pid
(ProcessRunning)
I, [2008-01-29T12:57:13.665885 #70] INFO -- : backgroundrb [ok] tries
within bounds [1/5] (Tries)
I, [2008-01-29T12:57:43.172296 #70] INFO -- : backgroundrb [ok]
backgroundrb God::Conditions::ProcessRunning: no such pid file: /
Volumes/OtherInboxDev/otherinbox/shared/log/backgroundrb.pid
(ProcessRunning)
I, [2008-01-29T12:57:43.424154 #70] INFO -- : backgroundrb [ok] tries
within bounds [2/5] (Tries)
I, [2008-01-29T12:58:13.205674 #70] INFO -- : backgroundrb [ok]
backgroundrb God::Conditions::ProcessRunning: no such pid file: /
Volumes/OtherInboxDev/otherinbox/shared/log/backgroundrb.pid
(ProcessRunning)
I, [2008-01-29T12:58:13.457650 #70] INFO -- : backgroundrb [ok] tries
within bounds [3/5] (Tries)
I, [2008-01-29T12:58:43.099112 #70] INFO -- : backgroundrb [ok]
backgroundrb God::Conditions::ProcessRunning: no such pid file: /
Volumes/OtherInboxDev/otherinbox/shared/log/backgroundrb.pid
(ProcessRunning)
I, [2008-01-29T12:58:43.351051 #70] INFO -- : backgroundrb [ok] tries
within bounds [4/5] (Tries)
I, [2008-01-29T12:59:13.135258 #70] INFO -- : backgroundrb [ok]
backgroundrb God::Conditions::ProcessRunning: no such pid file: /
Volumes/OtherInboxDev/otherinbox/shared/log/backgroundrb.pid
(ProcessRunning)
I, [2008-01-29T12:59:13.386950 #70] INFO -- : backgroundrb [trigger]
tries exceeded [5/5] (Tries)
The relevant watch is:
God.watch do |w|
w.name = "backgroundrb"
w.group = "support-services"
w.interval = 30.seconds
w.grace = 15.seconds
w.start = "#{RAILS_ROOT}/script/backgroundrb start"
w.stop = "#{RAILS_ROOT}/script/backgroundrb stop"
w.pid_file = "#{APP_ROOT}/shared/log/backgroundrb.pid"
# clean pid files before start if necessary
w.behavior(:clean_pid_file)
# 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
end
# failsafe
on.condition(:tries) do |c|
c.times = 5
c.transition = :start
end
end
# start if process is not running
w.transition(:up, :start) do |on|
on.condition(:process_exits) { |c| c.notify = 'developers' }
end
w.lifecycle do |on|
on.condition(:flapping) do |c|
c.to_state = [:start, :restart]
c.times = 5
c.within = 5.minute
c.transition = :unmonitored
c.retry_in = 10.minutes
c.retry_times = 5
c.retry_within = 2.hours
c.notify = 'developers'
end
end
end
I'm using rev 305 of backgroundrb on edge rails, and I've verified
that the above listed location for the PID file is correct.
Thanks for any help you might be able to provide. I love this
software!
Also, for testing purposes, it works very well on Tiger -- I even have
launchd starting it. It also works on Leopard, but I couldn't get
launchd to play nice, so on my Leopard system I start god from /etc/
rc.local
-Mike