[Win32utils-devel] [Fwd: Ruby Win32-Service]

John-Mason P. Shackelford john-mason at shackelford.org
Mon Jun 19 12:40:24 EDT 2006


> I have just started doing some work with win32-service -- I was
> creating a wrapper around it and daemon.rb, so I could write one body
> of code that depending upon platform would provide a reasonable
> interface for both windows and Unix platforms.

I am interested in this work and have been hoping to do something
similiar myself. On the *nix side I have been using the Daemons
library (available as a gem) with an API call like so:

# 1. Create a proc that launches the program you wish to daemonize:
proc = Proc.new do

# 2. Configure (most of this is optional)
options = {
             :app_name   => "myd",
             :dir_mode   => :normal,
             :dir        => config.pid_dir,
             :multiple   => false,
             :ontop      => false,
             :backtrace  => true,
             :log_output => true,
             :monitor    => true,
             :mode       => :proc,
             :proc       => proc

# 3. Create the Daemon process, etc.
controller = Daemons::Controller.new(options, ARGV)
controller.catch_exceptions do

In additon to daemonizing the supplied proc this creates a complete
init script with start, stop, restart, and status commands and handles
PID file management, etc. See http://daemons.rubyforge.org/.

But like you I'd like to be able abstract this and creation of the
win32 service away from developer so that we can using a single simple
API that will work across platforms. For the sake of the cross
platform support I'd happily trade some configurability and
flexability (at least in the short run) in the spirit of POpen4

If you are interested in working together on this drop me a line.
John-Mason Shackelford

Software Developer
Pearson Educational Measurement

2510 North Dodge St.
Iowa City, IA 52245
ph. 319-354-9200x6214
john-mason.shackelford at pearson.com

More information about the win32utils-devel mailing list