Ben Allfree :: Painless Programming

Guaranteed results for iPhone, Rails, PHP, .NET, Flash, and more

Liking daemontools

September 30th, 2008 · No Comments

I run a lot of Ruby daemons and web servers for them. Managing all those init.d scripts was harder until I realized that I didn’t have to learn bash/sh to do it. I could write my init.d scripts in Ruby. Well that improved things, but now I’m caught once again in the middle of rolling something from scratch that does exactly what I want, or picking up something like daemontools that looks like it will probably do most of what I want.

A few nice things about daemontools:

* Monitors and restarts failed services
* Logs output from STDOUT and STDERR

The restarting failed services has some benefits. Generally I feel that a failed service probably will just fail again if it is restarted, but there are a few cases where it might be helpful. For example if someone accidentally kills your process, it will fire up again. That could be nice. But is it worth the added complexity?

The last point is kind of a big one because not everything uses a logger class. Invariably, some part of your app or some library you use is going to throw an exception to STDERR and it will get swallowed unless you have something like daemontools catching it.

Some guy wrote a Ruby-based Daemon class that looks like it knows how to start/stop/restart. It could be modified to re-launch the process if it exits. If nothing else, it serves as a good model for what might end up being good progress toward my quest of 100% automation.

Tags: ,

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Leave a Comment