On Fri, 13 Aug 2004 09:50:58 +0900, Mehr, Assaph (Assaph)
<assaph / avaya.com> wrote:
> Hi All,
> 
> I almost got to the point where I can install any ruby program as a
> Windows
> service. I do this using cygwin. For example to install Instiki as a
> service:
> 
> $ cygrunsrv --instal Instiki --path c:/ruby/bin/ruby.exe --args
> c:/Stuff/instiki-0.9.1/instiki.rb
> 
> The executable for the service (--path) is my Win32 (not cygwin's) Ruby
> executable. The argument is the name of the ruby script to run.
> 
> The service installs and start fine, but cannot be stopped (the process
> has
> to be manually killed). I have tried specifying various termination
> signals
> (using --termsig) and using a Kernel#trap to respond to them, but the
> trap
> is never executed, and the process doesn't stop. E.g.:
>   trap("TERM") { @server.shutdown; exit(0) }
> 
> The only signal that stops the process is SIGSEGV, which isn't very nice
> :P.
> Besides, even traps for it don't work.
> 
> Any clues as to how to fix?
> 

Not exactly what you're asking for, but there used to be a program
that came with the Windows NT resource kit called "srvany.exe".  It
does the same thing as the cygwin program, but it doesn't use Cygwin. 
I wonder if it would work better for you?  It apparently works on all
of the newer versions of Windows, too.  I'm not sure where you could
get it now, though.

Chad
International Ruby Conference - http://rubycentral.org/conference
RubyGems! - http://rubygems.rubyforge.org