Old 17th February 2007, 14:02   #1
MidnightJava
Junior Member
 
Join Date: Sep 2006
Location: Springfield, Virginia, USA
Posts: 45
Starting a Windows service

I created a simple silent installation script to install a Windows service using the System plug-in created by dselkirk, found here:

http://nsis.sourceforge.net/archive/...php?pageid=345

My script is pasted below. The executable file is a java launcher (created with NSIS) that runs a java program that listens for connections on a specified port.

When I launch rcb_serv.exe (the output file of my service insallation script), the service is created but not yet started (as expected). When I start the service using the Windows service manager, the java program begins running as expected. However, the Windows service manager believes that the service did not start. It throws the error:

Error 1053: The service did not respond to the start or control request in a timely fashion

Am I supposed to do something else in the NSIS script to make the service manager happy? Or is my program supposed to do something to complete the handshake?

Here's my script:

; Service Installer
;--------------

Name "RCB_Service_Install"
Caption "RCB Service Installer"
OutFile "rcb_serv.exe"

SilentInstall silent
AutoCloseWindow true
ShowInstDetails nevershow

!include servicelib.nsh
!define EXE_FILE "rcb.exe"

Section ""

!insertmacro SERVICE "create" "rcb_server"\
"path=c:\Documents and Settings\<my user name>\My Documents\RCB\rcb.exe;\
autostart=1;display=rcb_server;"


SectionEnd

-Mark
MidnightJava is offline   Reply With Quote
Old 17th February 2007, 14:15   #2
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
You can't start any executable as a service. A server executable must act as a service, call specific API functions and respond to specific messages.

See more at MSDN:

http://msdn2.microsoft.com/en-us/library/ms687416.aspx

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 21st February 2007, 00:20   #3
MidnightJava
Junior Member
 
Join Date: Sep 2006
Location: Springfield, Virginia, USA
Posts: 45
Thanks, I figured that was the case. I did find this nifty open source tool for wrapping java server apps as Windows services and Unix daemons. It took me five minutes to create a Windows service with it.
.

-Mark
MidnightJava is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump