Huberto,

Thanks for sharing your observation.  There are no clear examples for
non-daemon scripts.  I commented out

w.restart = "#{w.start}"

and hopefully, this will work. (The examples are all for daemons.)

Do you see two god sock files under tmp?

-M

On Feb 4, 1:36 pm, huberto <[email protected]> wrote:
> i am seeing similar behavior on my machine (also 64-bit ubuntu, but
> version 8.10 instead of 9.10).
>
> when i run sudo god -c god_config.god, htop sees two two god processes
> starting up and thus two processes for each watch specified in the
> config file. i wonder if these are related issues.
>
> that being said, and i am new to god, i'm wondering if your config
> file is what's causing the process not to be killed.
>
> w.start = "/usr/local/ruby/bin/ruby /home/xman/code/test.rb"
> w.restart = "#{w.start}"
>
> given these commands if you issue sudo god restart jruby-test, it will
> just start up a new process for test.rb. it should still work if you
> issue it a stop and then start command individually though.
>
> here's the config file i'm using:
>
> RAILS_ROOT = File.dirname(File.dirname(__FILE__))
>
> def generic_monitoring(w, options = {})
>   w.start_if do |start|
>     start.condition(:process_running) do |c|
>       c.interval = 10.seconds
>       c.running = false
>     end
>   end
>
>   w.restart_if do |restart|
>     restart.condition(:memory_usage) do |c|
>       c.above = options[:memory_limit]
>       c.times = [3, 5] # 3 out of 5 intervals
>     end
>   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 = {:contacts => 'support'}
>     end
>   end
>
>   w.transition(:up, :start) do |on|
>      on.condition(:process_exits) do |c|
>        c.notify = {:contacts => 'support'}
>      end
>    end
> end
>
> God.watch do |w|
>   script = "#{RAILS_ROOT}/app/background/finished_waves_checker.rb"
>   w.name = "finished_waves_checker"
>   w.group = "wave_processors"
>   w.interval = 60.seconds
>   w.start = "#{RAILS_ROOT}/script/runner #{script}"
>   w.start_grace = 20.seconds
>   w.restart_grace = 20.seconds
>
>   w.behavior(:clean_pid_file)
>
>   generic_monitoring(w, :memory_limit => 100.megabytes)
> end
>
> 5.times do |i|
>   God.watch do |w|
>     script = "#{RAILS_ROOT}/app/background/background_matcher.rb"
>     w.name = "background_matcher_#{i.to_s}"
>     w.group = "wave_processors"
>     w.interval = 60.seconds
>     w.start = "#{RAILS_ROOT}/script/runner #{script}"
>     w.start_grace = 20.seconds
>     w.restart_grace = 20.seconds
>
>     w.behavior(:clean_pid_file)
>
>     generic_monitoring(w, :memory_limit => 100.megabytes)
>   end
> end
>
> God.watch do |w|
>   script = "#{RAILS_ROOT}/app/background/printed_queue_checker.rb"
>   w.name = "kiosk-notification-checker"
>   w.group = "wave_processors"
>   w.interval = 60.seconds
>   w.start = "#{RAILS_ROOT}/script/runner #{script}"
>   w.start_grace = 20.seconds
>   w.restart_grace = 20.seconds
>
>   w.behavior(:clean_pid_file)
>
>   generic_monitoring(w, :memory_limit => 100.megabytes)
> end
>
> any help appreciated.
>
> -h
>
> On Feb 3, 1:48 pm, Ming <[email protected]> wrote:
>
>
>
> > on restarts and terminations, god doesn't kill non-daemon processes it
> > has started.  i have to kill the manually. system is 64-bit Ubuntu
> > 9.10.
>
> > >sudo god check
>
> > yields:
>
> > using event system: netlink
> > starting event handler
> > forking off new process
> > forked process with pid = 12693
> > killing process
> > [ok] process exit event received
>
> > so the cn module requisite has been satisfied.
>
> > config:
>
> >  God.watch do |w|
> >     w.uid = 'xman'
> >     w.gid = 'xman'
> >     w.log = "/home/xman/code/god.log"
> >     w.dir = "/home/xman/code
> >     w.name = "jruby-test"
> >     w.interval = 180.seconds # default
> >     w.start = "/usr/local/ruby/bin/ruby /home/xman/code/test.rb"
> >     w.restart = "#{w.start}"
> >     w.start_grace = 120.seconds
> >     w.restart_grace = 120.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
>
> >     w.restart_if do |restart|
> >       restart.condition(:file_time) do |c|
> >         c.above = 180.seconds
> >       end
> >     end
>
> >     # lifecycle
> >     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 = 3.minutes
> >         c.retry_times = 5
> >         c.retry_within = 2.hours
> >       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