Skip to content

Instantly share code, notes, and snippets.

@cypher
Created September 23, 2009 16:09
Show Gist options
  • Save cypher/192088 to your computer and use it in GitHub Desktop.
Save cypher/192088 to your computer and use it in GitHub Desktop.
# run with: god -c /path/to/worker.god
#
# Keep workers up & running
God.load File.join(File.dirname(__FILE__), 'email.god')
4.times do |worker_id|
God.watch do |w|
w.name = "asset-worker-#{worker_id}"
w.interval = 10.seconds
w.start = "ruby #{File.join(File.dirname(__FILE__), *%w{.. worker.rb})}"
w.uid = 'assets'
w.gid = 'assets'
w.group = "asset-workers"
w.start_if do |start|
start.condition(:process_running) do |c|
c.running = false
end
end
# Notify on process exit
w.transition(:up, :start) do |on|
on.condition(:process_exits) do |c|
c.notify = 'lomo'
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment