w.start is not being executed

10 views
Skip to first unread message

ptc

unread,
Jun 30, 2009, 12:15:21 PM6/30/09
to god.rb
Hi,

I've written a GOD file to run a Ruby file:

God.watch do |w|
# watch with no pid_file attribute set
w.group = "AGroup"
w.name = "SomeName"
w.start = "ruby /path/to/ruby_file.rb"
end

But if I start GOD with -c myfile.god -D it says that SomeName has
been moved from "unmonitored" to "up", but ruby /path/to/ruby_file.rb
is never executed. I noticed that, because my ruby_file.rb has some
side effects on a memcached server and running it by GOD makes
memcached do nothing as ruby_file.rb never connects.

What's wrong with that?

ptc

unread,
Jun 30, 2009, 2:52:45 PM6/30/09
to god.rb
Actually it even doesn't run if I try to monitor script/server:

God.watch do |w|
w.name = "some_name"
w.start = "/path/to/rails_dir/script/server"
w.grace = 10.seconds
w.behavior(:clean_pid_file)

w.start_if do |start|
start.condition(:process_running) do |c|
c.interval = 5.seconds
c.running = false
end
end
end


god -c lib/worker/dw.god -D --log-level=debug

I [2009-06-30 20:49:08] INFO: Using pid file directory: /tmp/pids
I [2009-06-30 20:49:08] INFO: Started on drbunix:///tmp/god.17165.sock
I [2009-06-30 20:49:08] INFO: cpt_distributed_worker_0 move
'unmonitored' to 'up'
D [2009-06-30 20:49:08] DEBUG: driver schedule
#<God::Conditions::ProcessRunning:0x19946b0> in 0 seconds
I [2009-06-30 20:49:08] INFO: cpt_distributed_worker_0 moved
'unmonitored' to 'up'
I [2009-06-30 20:49:08] INFO: cpt_distributed_worker_0 [ok] process
is running (ProcessRunning)
D [2009-06-30 20:49:08] DEBUG: cpt_distributed_worker_0 ProcessRunning
[false] {true=>:start}
D [2009-06-30 20:49:08] DEBUG: driver schedule
#<God::Conditions::ProcessRunning:0x19946b0> in 5 seconds


Running on OSX 10.5
god (0.7.13)

ptc

unread,
Jul 1, 2009, 12:07:44 PM7/1/09
to god.rb
Solution:

One have to pass the scripts entire path:

w.start = "/usr/bin/ruby /path/to/script.rb"
Reply all
Reply to author
Forward
0 new messages