PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.ruby > another win32 service error
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
another win32 service error

Réponse
 
LinkBack Outils de la discussion
Vieux 25/02/2008, 23h22   #1
Junkone
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut 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'
)


  Réponse avec citation
Vieux 26/02/2008, 07h24   #2
Luis Lavena
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: another win32 service error

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'
> )


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.p...elease_id=8222

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

HTH,
--
Luis Lavena
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 08h37.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,09477 seconds with 10 queries