I took
- jenkins.exe
- jenkins.exe.config
- jenkins.xml
from the installation of master Jenkins. Then I adapted the XML to contain the launch options of my slave. This gives something like:
<executable>%JAVA_HOME%\bin\java.exe</executable> <arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "C:\Tools\jenkins_slave\slave_95\agent.jar" -jnlpUrl http://jenkins_master:9090/computer/slave_95/slave-agent.jnlp -secret 999999999999999999999999999999999999999999 -workDir "C:\jenkins_slaves_workdir"</arguments>
In XML, I also have: - edited the fields for id, name, description in my preferences - deleted the contents of the extension block
After that, I can simply start the Windows service by running the admin shell on the slave using the command:
sc create <service_name> binpath= "C:\Tools\jenkins_slave\slave_95\Jenkins.exe" start= auto
Which is basically the same as launching the Jenkins master service.
source share