<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>YAB &#187; god</title>
	<atom:link href="http://blog.alexgirard.com/tag/god/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.alexgirard.com</link>
	<description>Yet Another Blog</description>
	<pubDate>Sat, 15 Nov 2008 01:14:59 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
	<language>en</language>
			<item>
		<title>[Ruby] One line to save God</title>
		<link>http://blog.alexgirard.com/ruby-one-line-to-save-god/</link>
		<comments>http://blog.alexgirard.com/ruby-one-line-to-save-god/#comments</comments>
		<pubDate>Thu, 25 Oct 2007 22:05:55 +0000</pubDate>
		<dc:creator>alx</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[error]]></category>

		<category><![CDATA[god]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://blog.alexgirard.com/2007/10/25/ruby-one-line-to-save-god/</guid>
		<description><![CDATA[We&#8217;ve had unexpecting interruptions in our Feevy updaters last weeks, and the error (which is still strange) came from inside God, it was unable to decide if a process was still running.
If you&#8217;ve the same kind of problem, with your god logging showing &#8220;kill: 1: No such process&#8220;, then change the exists? method in /usr/local/lib/ruby/gems/1.8/gems/god-0.5.0/lib/god/system/process.rb [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve had unexpecting interruptions in our Feevy updaters last weeks, and the error (which is still strange) came from inside God, it was unable to decide if a process was still running.</p>
<p>If you&#8217;ve the same kind of problem, with your god logging showing &#8220;<em>kill: 1: No such process</em>&#8220;, then change the <strong>exists?</strong> method in <strong>/usr/local/lib/ruby/gems/1.8/gems/god-0.5.0/lib/god/system/process.rb</strong> file, gem path might not be the same on your system.</p>
<pre class="prettyprint">
# Return true if this process is running, false otherwise
def exists?
    # system("kill -0 #{@pid} &#038;> /dev/null")
    ps_int('rss') != 0
end
</pre>
<p>Here is our configuration if some people can find where this line is causing problem: Ubuntu Gutsy, Ruby 1.8.6, God 0.5</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.alexgirard.com/ruby-one-line-to-save-god/feed/</wfw:commentRss>
		</item>
		<item>
		<title>[Ruby] God monitor</title>
		<link>http://blog.alexgirard.com/ruby-god-monitor/</link>
		<comments>http://blog.alexgirard.com/ruby-god-monitor/#comments</comments>
		<pubDate>Mon, 10 Sep 2007 17:00:43 +0000</pubDate>
		<dc:creator>alx</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[coding]]></category>

		<category><![CDATA[gem]]></category>

		<category><![CDATA[god]]></category>

		<category><![CDATA[madrid]]></category>

		<category><![CDATA[monitor]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://blog.alexgirard.com/2007/09/10/ruby-god-monitor/</guid>
		<description><![CDATA[Update: this script, from September 2007, is a bit out-dated, you can get more info on official God gem website.
Looking for a ruby programmer? Contact me
After many ways to monitor Feevy updaters, we&#8217;re finally using God gem today to manage everything with Ruby on many platforms.
Documentation is really clear, and it&#8217;s easy to adapt it [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update</strong>: this script, from September 2007, is a bit out-dated, you can get more info on <a href="http://god.rubyforge.org/">official God gem website</a>.</p>
<p><strong>Looking for a ruby programmer?</strong> <a href="mailto:alx.girard@gmail.com">Contact me</a></p>
<p>After many ways to monitor Feevy updaters, we&#8217;re finally using <a href="http://god.rubyforge.org/">God gem</a> today to manage everything with Ruby on many platforms.</p>
<p>Documentation is really clear, and it&#8217;s easy to adapt it to your own code. The nicest point was to be able to control our non-daemonized updaters, and monitor them all in the same tool.</p>
<p>Here is our script:</p>
<pre class="prettyprint">
require 'rubygems'
require 'god'

ROOT = File.dirname(__FILE__)

God.init do |god|
  god.pid_file_directory = "#{ROOT}/pids"
end

[*0...20].each do |updater|
  God.watch do |w|
    # watch with no pid_file attribute set
    w.name = "updater_#{updater}"
    w.interval = 30.seconds # default
    w.start = "ruby #{ROOT}/updater.rb"
    w.grace = 10.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(:memory_usage) do |c|
        c.above = 150.megabytes
        c.times = [3, 5] # 3 out of 5 intervals
      end

      restart.condition(:cpu_usage) do |c|
        c.above = 50.percent
        c.times = 5
      end
    end
  end
end
</pre>
<p>[updated]: thanks to apeiros on irc://#ruby@irc.freenode.net for quick array initialization tips!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.alexgirard.com/ruby-god-monitor/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
