Hi there!
First of all, god is great and greatly to be praised. Much
appreciation to everyone who has been working on it.
I do have a problem, however. I spent all day yesterday struggling
with getting god to reliably start and stop a sinatra app. I've
gotten god files that can stop a sinatra app *sometimes*, when I hit
god a bunch of times with successive monitor/stop commands, which
leads me to believe there's some kind of race condition happening, but
who knows.
Anyway, below are my .god file and my sinatra app, which are as
barebones as I could get them. The app starts, but when you ask it to
stop, it just keeps chugging along! It works to do:
god unmonitor myapp;kill `cat /var/run/god/myapp.pid`
But that sort of defeats the purpose of god!
Anyway, if anyone can unravel this mystery for me, you will relieve a
very large knot from my shoulders and make me feel a lot better about
how I spent my yesterday.
With love,
Erik
# config.god:
God.watch do |w|
w.name = "myapp"
w.interval = 30.seconds # default
w.start = "ruby /path/to/app.rb -p 20000"
w.start_grace = 10.seconds
w.restart_grace = 10.seconds
w.behavior(:clean_pid_file)
# Checks if process is running every 5 seconds
w.start_if do |start|
start.condition(:process_running) do |c|
c.interval = 5.seconds
c.running = false
end
end
end
# app.rb:
require 'rubygems'
require 'sinatra'
set :port, ARGV[1] if ARGV[0] == "-p"
get '/' do
"Hello World!"
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
-~----------~----~----~----~------~----~------~--~---