# God 0.3.0 released

**URL:** <https://www.ruby-forum.com/t/god-0-3-0-released/112546>\
**Category:** Ruby\
**Created:** [August 20, 2007, 8:08pm UTC](https://www.ruby-forum.com/t/god-0-3-0-released/112546 "2007-08-20T20:08:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomfarm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b5ac83/32.png) [@tomfarm](https://www.ruby-forum.com/u/tomfarm)\
**Post date:** [August 20, 2007, 8:08pm UTC](https://www.ruby-forum.com/t/god-0-3-0-released/112546/1 "2007-08-20T20:08:59Z")

</div>

Plenty of big changes and improvements in this release of god. Most  
noticeable is a simplification of the config file. Sadly, we must say  
goodbye to the much loved God.meddle and promote God.watch to top level.  
This change allows you to easily load in other god config files and have  
them work as expected. There’s even a God.load that takes a glob-style  
file path string and expands it to load multiple files.

PID file support is now baked in so you don’t have to set the pid\_file  
attribute on conditions anymore. This also allows god to support  
processes that aren’t already daemons. If you don’t specify a PID file  
for the watch, god will auto-daemonize and keep track of your process  
for you! To use this feature, you must either run as root (pid files  
will be stored by default in /var/run/god) or set the pid\_file\_directory  
attribute in a God.init block (see docs).

For anyone that had problems installing the 0.2.0 release because of the  
events system not compiling, god 0.3.0 will now allow you to install  
without event support. Most systems are capable of supporting events,  
but it requires some dedication to get the headers in place and make  
sure your kernel is new enough. To determine if your god installation  
has event support you can run “sudo god -V” (this MUST be run as root on  
Linux, as netlink connector requires root permissions).

Using the god binary you can now control your watches from the command  
line. You can start/stop/restart/monitor/unmonitor watches at your  
demand.

New watch attributes now available:  
pid\_file: sets the watch process’ PID file location  
uid/gid: start processes as someone else (requires root access)  
group: assign a watch to a group (to control them all at once)  
autostart: prevent auto start on god start if false

Updated documentation is now available on the website:

[http://god.rubyforge.org/](http://god.rubyforge.org/)

WHAT IS GOD?

God is an easy to configure, easy to extend monitoring framework written  
in Ruby.

Keeping your server processes and tasks running should be a simple part  
of your deployment process. God aims to be the simplest, most powerful  
monitoring application available.

DISCLAIMER

God is still very young, I’d love to get feedback and bug reports, but I  
do not yet recommend you use it for mission critical tasks. I personally  
use it in production but then I’m a daring fellow.

INSTALL

sudo gem install god

FEATURES

- Config file is written in Ruby
- Easily write your own custom conditions in Ruby
- Supports both poll and event based conditions
- Different poll conditions can have different intervals
- Easily control non-daemonized processes

EXAMPLE

The easiest way to understand how god will make your life better is by  
looking at a sample config file. The following configuration file is  
what I use at [gravatar.com](http://gravatar.com) to keep the mongrels running:

# file: gravatar.god

# run with: god -c /path/to/gravatar.god

# 

# This is the actual config file used to keep the mongrels of

# [gravatar.com](http://gravatar.com) running.

RAILS\_ROOT = “/var/www/gravatar2/current”

%w{8200 8201 8202}.each do |port|  
God.watch do |w|  
w.name = “gravatar2-mongrel-#{port}”  
w.interval = 30.seconds # default  
w.start = “mongrel\_rails cluster::start --only #{port}   
-C #{RAILS\_ROOT}/config/mongrel\_cluster.yml”  
w.stop = “mongrel\_rails cluster::stop --only #{port}   
-C #{RAILS\_ROOT}/config/mongrel\_cluster.yml”  
w.grace = 10.seconds  
w.pid\_file = File.join(RAILS\_ROOT, “log/mongrel.#{port}.pid”)

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

DOCS

Detailed documentation is available at [http://god.rubyforge.org/](http://god.rubyforge.org/)

CHANGES

== 0.3.0 / 2007-08-17

- Fix netlink header problem on Ubuntu Edgy [Dan Sully]
- Add uid/gid setting for processes [kevinclark]
- Add autostart flag for watches so they don’t necessarily startup with  
god [kevinclark]
- Change command line call options for god binary to accommodate watch  
start/stop functionality
- Add individual start/stop/restart grace periods for finer grained  
control
- Change default DRb port to 17165 (‘god’.to\_i(32))
- Implement command line control to start/restart/stop/monitor/unmonitor  
watches/groups by name
- Watches can now belong to a group that can be controlled as a whole
- Allow god to be installed (sans events) on systems that don’t support  
events
- Daemonize and handle PID files for non-daemonizing scripts  
[kevinclark]
- Fix simple mode lifecycle gap
- Remove necessity to specify pid\_file for conditions
- Change config file to use God.init and God.watch directly instead of  
God.meddle block
- Move god binary command logic to main library
- Enhance god binary with better reporting
- Fix synchronization bug in Timer (reported by Srini Panguluri)
- Add Lambda condition for easy custom conditions [Mike Mintz]
- Add sugar for numerics (seconds, minutes, kilobytes, megabytes,  
percent, etc)
- Add optional PID and log file generation to god binary for daemon mode
- Add God.load to do glob enabled loading
- Add -V option to god binary for detailed version/build info

AUTHORS

Tom Preston-Werner  
Kevin C.

–  
Tom Preston-Werner

- Libraries:  
Chronic ([chronic.rubyforge.org](http://chronic.rubyforge.org))  
God ([god.rubyforge.org](http://god.rubyforge.org))  
Fuzed ([fuzed.rubyforge.org](http://fuzed.rubyforge.org))
- Site:  
[rubyisawesome.com](http://rubyisawesome.com)
