From: jenkinsci-***@googlegroups.com [mailto:jenkinsci-***@googlegroups.com] On Behalf Of Mark Bidewell
Sent: Monday, October 15, 2018 4:35 PM
To: Jenkins Users <jenkinsci-***@googlegroups.com>
Subject: Re: Windows Agent As a Service
Thanks! but how do you make it run as a service from the command-line? done of the exes seem to be installed?
We use a scheduled task and batch file like so:
agent.xml:
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2018-05-09T14:00:56.3287384</Date>
<Author>domain\user</Author>
<Description>Jenkins node/slave agent launcher</Description>
</RegistrationInfo>
<Triggers>
<BootTrigger>
<Enabled>true</Enabled>
</BootTrigger>
</Triggers>
<Principals>
<Principal id="Author">
<UserId>S-1-5-18</UserId>
<RunLevel>HighestAvailable</RunLevel>
</Principal>
</Principals>
<Settings>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>true</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>true</StopIfGoingOnBatteries>
<AllowHardTerminate>true</AllowHardTerminate>
<StartWhenAvailable>true</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
<IdleSettings>
<StopOnIdleEnd>true</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>true</Enabled>
<Hidden>false</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<WakeToRun>false</WakeToRun>
<ExecutionTimeLimit>PT0S</ExecutionTimeLimit>
<Priority>7</Priority>
<RestartOnFailure>
<Interval>PT30M</Interval>
<Count>399</Count>
</RestartOnFailure>
</Settings>
<Actions Context="Author">
<Exec>
<Command>c:\jenkins\agent.cmd</Command>
<WorkingDirectory>c:\jenkins\</WorkingDirectory>
</Exec>
</Actions>
</Task>
agent.cmd:
REM set PATH, change drive, change directory, etc...
java -jar agent.jar -jnlpUrl https://jenkins.server.tld/jenkins/computer/hostname/slave-agent.jnlp -secret 9999999999999999999999999999999999999999999999999999999999999999 1>> agent-%date:~-4,4%%date:~-10,2%%date:~-7,2%.log 2>&1
set agenExitCode=%errorlevel%
(echo %date% %time% jenkins agent exit && echo exit code %agenExitCode%) 1>> agent-%date:~-4,4%%date:~-10,2%%date:~-7,2%.log 2>&1
exit /B %agenExitCode%
On Monday, October 15, 2018 at 4:31:03 PM UTC-4, Mark Waite wrote:
The deprecation of Java Web Start doesn't deprecate the protocols that a Jenkins agent can use to connect to the Jenkins server. JNLP works just fine with Java 11 to connect an agent.
The convenience of clicking the "Web Start" button on the UI won't work with Java 11, but the command line provided in the agent start page continues to work.
Mark Waite
On Mon, Oct 15, 2018 at 2:18 PM Mark Bidewell <***@gmail.com <javascript:> > wrote:
With Java Web Start deprecated and slated for removal, what is the canonical way to create a Windows Service agent?
Thanks!
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-***@googlegroups.com <javascript:> .
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/439b2186-1f70-46bd-b0f8-c54512eb428b%40googlegroups.com <https://groups.google.com/d/msgid/jenkinsci-users/439b2186-1f70-46bd-b0f8-c54512eb428b%40googlegroups.com?utm_medium=email&utm_source=footer> .
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+***@googlegroups.com <mailto:jenkinsci-users+***@googlegroups.com> .
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/06519949-d6f0-49dd-9349-62b56b776e4f%40googlegroups.com <https://groups.google.com/d/msgid/jenkinsci-users/06519949-d6f0-49dd-9349-62b56b776e4f%40googlegroups.com?utm_medium=email&utm_source=footer> .
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/019001d464ca%24bdf99990%2439ecccb0%24%40pdinc.us.
For more options, visit https://groups.google.com/d/optout.