In case you haven't found the answer yet, I think the issue is because
you are using the init.d script instead of apachectl like in the
example you point to.  Essentially, when using the init script without
stating a pid file, I think god is really monitoring whether the init
script is running - not apache.  Have you tried adding the apache pid
file path to you god configuration?

Or, you could grab the shell command executed in the init.d file and
replace /etc/init.d/apache2 start/stop in your god config. (But, I
think the right approach is to add the pid file declaration)

On Mar 16, 12:49 pm, Brian McManus <[email protected]> wrote:
> So I followed this blog to get get an apache.god set 
> up:http://blog.blenderbox.com/2008/03/11/monitoring-apache-with-god/
>
> I stop apache by hand and then start it with god -c apache.god.  god
> status indicates that apache is up.  All seems good.  The problem is
> when I stop apache with sudo /etc/init.d/apache2 stop by hand, god
> tries to start it (and seems to succeed since I can get to my site
> still) but then if I watch the log it keeps trying to start it every
> 20 seconds... It seems to be based on the start_grace value.
> Originally the author had 10.seconds so I upped it to 20.seconds but
> it doesn't seem to matter what value I use.
>
> The only things I added were a flapping condition and I changed the
> commands since I don't have apachectl installed to use /etc/init.d/
> apache2.  Here is my config and below that is output from god log
> apache:
>
> %w{80}.each do |port|
>   God.watch do |w|
>     w.name = "apache"
>     w.interval = 30.seconds # default
>     w.start = "/etc/init.d/apache2 start"
>     w.stop = "/etc/init.d/apache2 stop"
>     w.restart = "/etc/init.d/apache2 restart"
>     w.start_grace = 20.seconds
>     w.restart_grace = 20.seconds
>
>     w.start_if do |start|
>       start.condition(:process_running) do |c|
>           c.interval = 5.seconds
>           c.running = false
>       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 = 10.minutes
>         c.retry_times = 5
>         c.retry_within = 2.hours
>       end
>     end
>   end
> end
>
> # god log apache
> I [2009-03-16 16:27:26]  INFO: apache Loaded config
> I [2009-03-16 16:27:26]  INFO: apache move 'unmonitored' to 'up'
> I [2009-03-16 16:27:26]  INFO: apache moved 'unmonitored' to 'up'
> I [2009-03-16 16:27:26]  INFO: apache [trigger] process is not running
> (ProcessRunning)
> I [2009-03-16 16:27:26]  INFO: apache move 'up' to 'start'
> I [2009-03-16 16:27:26]  INFO: apache start: /etc/init.d/apache2 start
> I [2009-03-16 16:27:46]  INFO: apache moved 'up' to 'up'
> I [2009-03-16 16:27:46]  INFO: apache [trigger] process is not running
> (ProcessRunning)
> I [2009-03-16 16:27:46]  INFO: apache move 'up' to 'start'
> I [2009-03-16 16:27:46]  INFO: apache start: /etc/init.d/apache2 start
> I [2009-03-16 16:28:06]  INFO: apache moved 'up' to 'up'
> I [2009-03-16 16:28:06]  INFO: apache [trigger] process is not running
> (ProcessRunning)
> I [2009-03-16 16:28:06]  INFO: apache move 'up' to 'start'
> I [2009-03-16 16:28:06]  INFO: apache start: /etc/init.d/apache2 start
> I [2009-03-16 16:28:26]  INFO: apache moved 'up' to 'up'
> I [2009-03-16 16:28:26]  INFO: apache [trigger] process is not running
> (ProcessRunning)
> I [2009-03-16 16:28:26]  INFO: apache move 'up' to 'start'
> I [2009-03-16 16:28:26]  INFO: apache start: /etc/init.d/apache2 start
> I [2009-03-16 16:28:46]  INFO: apache moved 'up' to 'up'
> I [2009-03-16 16:28:46]  INFO: apache [trigger] process is not running
> (ProcessRunning)
> I [2009-03-16 16:28:46]  INFO: apache move 'up' to 'start'
> I [2009-03-16 16:28:46]  INFO: apache start: /etc/init.d/apache2 start
--~--~---------~--~----~------------~-------~--~----~
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