you may not want to use upstart scripts if you want god  to watch it for
the reasons Chris gave you. Look at the upstart script and move the
commands to start and stop it to the god config instead of using the
upstart script. On the other hand if you just add 'respawn' to the upstart
script if it isn't already there and don't watch it with god the only thing
you are missing is the notification of the events.

On my systems, I use upstart to watch and respawn god, and I use god to
watch and restart everything else because we like the campfire and email
notifications when something is acting wonky.

if you paste the upstart script most likely: /etc/init/prosody.conf

we may be able to advise how to convert it to a native god config.

On Thu, Sep 6, 2012 at 6:45 AM, Chris Cosby <[email protected]> wrote:

> The process you're trying to start is the "service" command, which exits
> as soon as the real daemon starts, so God doesn't have a job to do. If you
> want to monitor something started by service, you'll need to add w.pid_file
> to point to the same place that your daemon pid file is written to watch
> that pid. I haven't tried it, but it should JustWork.
>
>
> On Thu, Sep 6, 2012 at 3:24 AM, rubybox <[email protected]> wrote:
>
>>
>> Hi everyone im trying to make both elasticsearch and prosody be monitored
>> with God both fail to start.
>> Resuting in
>>
>> I [2012-09-06 09:22:18]  INFO: Loading elasticsearch.god
>> I [2012-09-06 09:22:18]  INFO: Syslog enabled.
>> I [2012-09-06 09:22:18]  INFO: Using pid file directory: /var/run/god
>> I [2012-09-06 09:22:18]  INFO: Started on drbunix:///tmp/god.17165.sock
>> I [2012-09-06 09:22:18]  INFO: elasticsearch move 'unmonitored' to 'init'
>> I [2012-09-06 09:22:18]  INFO: elasticsearch moved 'unmonitored' to 'init'
>> I [2012-09-06 09:22:18]  INFO: elasticsearch [trigger] process is not
>> running (ProcessRunning)
>> I [2012-09-06 09:22:18]  INFO: elasticsearch move 'init' to 'start'
>> I [2012-09-06 09:22:18]  INFO: elasticsearch start: service elasticsearch
>> start
>> I [2012-09-06 09:22:28]  INFO: elasticsearch moved 'init' to 'start'
>> I [2012-09-06 09:22:28]  INFO: elasticsearch [ok] process is not running
>> (ProcessRunning)
>> I [2012-09-06 09:22:28]  INFO: elasticsearch [ok] tries within bounds
>> [1/5] (Tries)
>> ETC
>>
>>
>> This is my prosody.god.rb file the rails root env is just path to my
>> rails app wich is included in my app but could be easily removed.
>> What am I missing here that it won't start?
>>
>> God.watch do |w|
>>
>>   w.name = "prosody"
>>   w.interval = 30.seconds
>>   w.start = "service prosody start"
>>   w.stop = "service prosody stop"
>>   w.restart = "#{w.stop} && #{w.start}"
>>   w.start_grace = 10.seconds
>>   w.restart_grace = 10.seconds
>>   # w.log = File.join(ENV['RAILS_ROOT'], 'log', 'cumulus.log')
>>
>>   # 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
>>       c.interval = 5.seconds
>>     end
>>
>>     # failsafe
>>     on.condition(:tries) do |c|
>>       c.times = 5
>>       c.transition = :start
>>       c.interval = 5.seconds
>>     end
>>   end
>>
>>   # start if process is not running
>>   w.transition(:up, :start) do |on|
>>     on.condition(:process_running) do |c|
>>       c.running = false
>>     end
>>   end
>>
>> end
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "god.rb" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/god-rb/-/SkEHYGzfoBIJ.
>> 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.
>>
>
>
>
> --
> chris -at- microcozm -dot- net
> == If you wish to make an apple pie from scratch, you must first invent
> the universe. - Carl Sagan
> === My crypto keys: http://www.microcozm.net/~ccosby/keys/
>
>  --
> 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.
>

-- 
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