Another win32 service error

Is there anything that my executable should do in order to be a
service. i have created services before with vb and have not
experienced issues. bat file is a simple one having this statemetn.
thin start -e production -p 3000

When i run it directly, it works. but i run it as part of the
servicem, the start up fails with this error

This is some service service failed to start due to the following
error:
The service did not respond to the start or control request in a
timely fashion.

My code for the service implementation is

require "win32/service"
   include Win32

   # Create a new service
   Service.create('some_service', nil,
      :service_type => Service::WIN32_OWN_PROCESS,
      :description => 'A custom service I wrote just for fun',
      :start_type => Service::AUTO_START,
      :error_control => Service::ERROR_NORMAL,
      :binary_path_name => 'E:\TradingTools\torontotrader
\startServer.bat',
      :load_order_group => nil,
      :dependencies => nil,
      :service_start_name => 'LocalSystem',
      :password => nil,
      :display_name => 'This is some service'
   )

First and most important: read the documentation.

What your script is actually doing is creating a service, a service
requires a special series of hooks to communitate with Service Control
Manager (SCM) and a batch file (.bat) cannot provide it.

Also, you cannot use a bat file directly in this case anyway, you need
to call cmd.exe and put the batch file as argument.

I'll suggest you take a look at the win32-service documentation and
samples:

win32utils docs (look at the win32-service section)
http://rubyforge.org/docman/?group_id=85

ruby-services package at win32utils too:
http://rubyforge.org/frs/shownotes.php?group_id=85&release_id=8222

That contains examples of implementing a RubyGems service or FastRI
services.

HTH,

···

On Feb 25, 9:22 pm, Junkone <junko...@gmail.com> wrote:

Is there anything that my executable should do in order to be a
service. i have created services before with vb and have not
experienced issues. bat file is a simple one having this statemetn.
thin start -e production -p 3000

When i run it directly, it works. but i run it as part of the
servicem, the start up fails with this error

This is some service service failed to start due to the following
error:
The service did not respond to the start or control request in a
timely fashion.

My code for the service implementation is

require "win32/service"
   include Win32

   # Create a new service
   Service.create('some_service', nil,
      :service_type => Service::WIN32_OWN_PROCESS,
      :description => 'A custom service I wrote just for fun',
      :start_type => Service::AUTO_START,
      :error_control => Service::ERROR_NORMAL,
      :binary_path_name => 'E:\TradingTools\torontotrader
\startServer.bat',
      :load_order_group => nil,
      :dependencies => nil,
      :service_start_name => 'LocalSystem',
      :password => nil,
      :display_name => 'This is some service'
   )

--
Luis Lavena