Greetings, I'm fairly new at this and don't really know where to start
with this scenario:
God will manage 3 watches but, on god start, I only want one process
to start if none are running.
Each watch is an instance of the same script, a worker that checks
something, does something that takes a bit of time, sleeps, then
starts over. In normal use I only need one instance of this script
running. Sometimes though I want to 'fire up' one or both of the other
watches to get more throughput.
So I want to the default to be one running and also be able to add/
remove workers via god start/stop worker_n.
Does this make any sense? Is this a case that is suited to God or am I
trying to do something it was not intended to handle?
Geoff
P.S. Here's what I have so far
3.times do |count|
God.watch do |w|
w.group = 'workers'
w.uid = 'fred'
w.gid = 'derf'
w.name = "worker_#{c}"
w.start = "/home/me/worker.rb"
w.behavior(:clean_pid_file)
w.start_grace = 10.seconds
w.restart_grace = 10.seconds
w.start_if do |start|
start.condition(:process_running) do |c|
c.interval = 10.seconds
c.running = false
end
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
-~----------~----~----~----~------~----~------~--~---