[vwnc] Cleanly stopping Windows service

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[vwnc] Cleanly stopping Windows service

Mike Hales
I have an app that I run as a Windows service using Srvany.exe as described in the application developers guide. On Linux it runs as a daemon and is controlled by the appropriate init.d scripts. On linux, I can register with the object engine to receive the sigterm signals and shutdown the app cleanly when daemon is stopped with the following code:

OSHandle currentOS == #unix
ifTrue:
[sem := Semaphore new.
ObjectMemory registerObject: sem withEngineFor: 'SIGTERM'.
[sem wait.
ObjectMemory quit] forkAt: Processor userInterruptPriority].

Doing this allows the Subsystem framework to work correctly and the tearDown actions are all performed.

Does anyone know how I can do a similar thing when running the app as a Windows service. The behavior currently is that when the service is stopped, the app is just killed, and no code can be run prior to shutting down.

Thanks,

Mike

Mike Hales
Engineering Manager
KnowledgeScape
www.kscape.com

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Cleanly stopping Windows service

Mike Hales
Nevermind, I found the ServiceStartup package and thread in the list. Sorry for the noise.

Mike

Mike Hales
Engineering Manager
KnowledgeScape
www.kscape.com


On Fri, Apr 10, 2009 at 10:38 AM, Mike Hales <[hidden email]> wrote:
I have an app that I run as a Windows service using Srvany.exe as described in the application developers guide. On Linux it runs as a daemon and is controlled by the appropriate init.d scripts. On linux, I can register with the object engine to receive the sigterm signals and shutdown the app cleanly when daemon is stopped with the following code:

OSHandle currentOS == #unix
ifTrue:
[sem := Semaphore new.
ObjectMemory registerObject: sem withEngineFor: 'SIGTERM'.
[sem wait.
ObjectMemory quit] forkAt: Processor userInterruptPriority].

Doing this allows the Subsystem framework to work correctly and the tearDown actions are all performed.

Does anyone know how I can do a similar thing when running the app as a Windows service. The behavior currently is that when the service is stopped, the app is just killed, and no code can be run prior to shutting down.

Thanks,

Mike

Mike Hales
Engineering Manager
KnowledgeScape
www.kscape.com


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc