Starting Jenkins slave as Windows service

681 views
Skip to first unread message

eid badr

unread,
Nov 28, 2017, 10:04:29 AM11/28/17
to Jenkins Users
I'm trying to start Jenkins slave as a windows service, but I get the following error.
which second argument is required here?

2017-11-28 16:02:01 Commons Daemon procrun stderr initialized
java -jar slave.jar [options...] <secret key> <slave name>
 -cert WERT                      : Specify additional X.509 encoded PEM
                                   certificates to trust when connecting to
                                   Jenkins root URLs. If starting with @ then
                                   the remainder is assumed to be the name of
                                   the certificate file to read.
 -credentials USER:PASSWORD      : HTTP BASIC AUTH header to pass in for making
                                   HTTP requests.
 -headless                       : Run in headless mode, without GUI
 -jar-cache DIR                  : Cache directory that stores jar files sent
                                   from the master
 -noKeepAlive                    : Disable TCP socket keep alive on connection
                                   to the master.
 -noreconnect                    : If the connection ends, don't retry and just
                                   exit.
 -proxyCredentials USER:PASSWORD : HTTP BASIC AUTH header to pass in for making
                                   HTTP authenticated proxy requests.
 -tunnel HOST:PORT               : Connect to the specified host and port,
                                   instead of connecting directly to Jenkins.
                                   Useful when connection to Hudson needs to be
                                   tunneled. Can be also HOST: or :PORT, in
                                   which case the missing portion will be
                                   auto-configured like the default behavior
 -url URL                        : Specify the Jenkins root URLs to connect to.

itchymuzzle

unread,
Nov 28, 2017, 11:06:28 AM11/28/17
to Jenkins Users
Not clear what command you used.
Message has been deleted

eid badr

unread,
Nov 28, 2017, 12:06:37 PM11/28/17
to Jenkins Users
I used procrun to generate the service
This is my configuration file:

set SERVICE_NAME=jenkinsTest99
set PR_INSTALL=g:\jenkins\test\prunsrv.exe
 
REM Service log configuration
set PR_LOGPREFIX=%SERVICE_NAME%
set PR_LOGPATH=c:\logs
set PR_STDOUTPUT=c:\logs\stdout.txt
set PR_STDERROR=c:\logs\stderr.txt
set PR_LOGLEVEL=Error
 
REM Path to java installation
set PR_JVM=%JAVA_HOME%\jre\bin\client\jvm.dll
set PR_CLASSPATH=g:\jenkins\test\slave.jar
 
REM Startup configuration
set PR_STARTUP=auto
set PR_STARTMODE=jvm
set PR_STARTCLASS=hudson.remoting.jnlp.Main
set PR_STARTMETHOD=main

 
REM Shutdown configuration
set PR_STOPMODE=jvm
set PR_STOPCLASS=Main
set PR_STOPMETHOD=stop
 
REM JVM configuration
set PR_JVMMS=256
set PR_JVMMX=1024
set PR_JVMSS=4000
set PR_JVMOPTIONS=-Duser.language=DE;-Duser.region=de
REM Install servic 
prunsrv.exe //IS//%SERVICE_NAME%



in the service properties I got 
g:\jenkins\test\prunsrv.exe //RS//jenkinsTest99

And when I start the service, I got the error message above

itchymuzzle

unread,
Nov 28, 2017, 1:29:47 PM11/28/17
to Jenkins Users
Go to Jenkins server, select the node you have defined for this Windows instance.  It will give you the command you need to run, on the command line.  

Test that that works on the command line, then figure our how to get procron to do that for you.  

The command will look something like this (use google for other examples): 

"java -jar agent.jar -jnlpUrl http://ip-of-jenkins-server:port-of-jenkins-server/computer/name-of-node/slave-agent.jnlp -secret long-unique-number"

eid badr

unread,
Nov 29, 2017, 4:15:10 AM11/29/17
to Jenkins Users

At the node i got only 
without any other parameter.

and the slave starts with no problem when I test it on the command line.

eid badr

unread,
Nov 29, 2017, 8:05:54 AM11/29/17
to Jenkins Users
OK, I was calling main method in hudson.remoting.jnlp.Main
set PR_STARTCLASS=hudson.remoting.jnlp.Main

Now im calling main method in hudson.remoting.Launcher and the service starts.

But when I stop the service it does not stop correctly because there is no stop method inside Launcher.
Is there a way to get the service to stop without the stop method?
Reply all
Reply to author
Forward
0 new messages