Set Jenkins Slave as Windows Service

本文介绍了一种在Windows环境中通过任务计划程序自动启动Jenkins Slave节点的方法,适用于无法直接安装为服务的情况。通过详细步骤指导如何配置命令行并设置计划任务确保Jenkins Slave能够随系统启动而自动运行。
ACE-Step

ACE-Step是由中国团队阶跃星辰(StepFun)与ACE Studio联手打造的开源音乐生成模型。 它拥有3.5B参数量,支持快速高质量生成、强可控性和易于拓展的特点。 最厉害的是,它可以生成多种语言的歌曲,包括但不限于中文、英文、日文等19种语言

 

Skip to end of metadata

 

Go to start of metadata

 

Table Of Contents

Steps

If you are having trouble getting the Java Web Start agent installed as a Windows service (ie, you followed the instructions on installing the slave as a service here but it didn't work), an alternative method of starting the service automatically when Windows starts is to use the Windows Scheduler. 

We take advantage of the Windows Scheduler's ability to run command at system startup

  1. Configure your node to use the "Launch slave agents via Java Web Start" launch method
    • Click Save
  2. Note the command required to launch the slave
    • On the new slave node's Jenkins page, note the slave command line shown. 
      • It will be like: java -jar slave.jar -jnlpUrl http://<JenkinsHostName>:8080/computer/<nodeName>/slave-agent.jnlp -secret <some_long_hex_string>
  3. Obtain the slave.jar file and copy it to your new Windows slave node
    • In the command line noted in the last step, the "slave.jar" is a hyperlink. Click it to download the slave.jar file.
    • Copy the slave.jar file to a permanent location on your slave machine
  4. Ensure that you have a java version available on your slave machine
    • If not, obtain and install a copy of Java
  5. Run the command manually from a CMD window on your slave to confirm that it works
    • Open the CMD window
    • Run the command (the one like java -jar slave.jar -jnlpUrl http://<JenkinsHostName>:8080/computer/<nodeName>/slave-agent.jnlp -secret <some_long_hex_string>)
    • Go back to the node's web page in Jenkins.  If everything works then page should say "Connected via JNLP agent"
    • Stop the command (control-c)
  6. Register a new scheduled job to run the same command
    • Open "Task Scheduler" on your windows machine
      • Start -> Run: task Scheduler
    • Create a basic task (Menu: Action -> Create Basic Task)
      • First page of the wizard:
        • Name: Jenkins Slave
        • Description (optional)
        • Click Next
      • Next page of the wizard
        • When do you want the task to start: select "When the computer starts"
        • Click Next
      • Next page of the wizard
        • What action do you want the task to perform: select "Start a program"
        • Click Next
      • Next page of the wizard
        • Program/Script: enter "java.exe" (or the full path to your java.exe)
        • Add arguments: enter the rest of the command, like " -jar slave.jar -jnlpUrl http://<JenkinsHostName>:8080/computer/<nodeName>/slave-agent.jnlp -secret <some_long_hex_string>"
        • eg: -jar D:\Scripts\jenkins\slave.jar -jnlpUrl http://jenkinshost.example.com:8080/computer/buildNode1/slave-agent.jnlp -secret d6a84df1fc4f45ddc9c6ab34b08f13391983ffffffffffb3488b7d5ac77fbc7
        • Click Next
      • Next page of the wizard
        • Click the check box "Open the Properties dialog for this task when I click Finish
        • Click Finish
    • Update the task's properties
      • On the General tab
        • Select the user to run the task as
        • Select "Run whether use is logged on or not"
      • On the settings tab
        • Uncheck "Stop the task if it runs longer than"
        • Check "Run the task as soon as possible after a scheduled start is missed"
        • Check "If the task failed, restart every: 10 minutes", and "Attempt to restart up to: 3 times"
      • Click OK
  7. Start the scheduled task and again check that Jenkins can connect
    • Go back to the node's web page in Jenkins.  If everything works then page should say "Connected via JNLP agent"

您可能感兴趣的与本文相关的镜像

ACE-Step

ACE-Step

音乐合成
ACE-Step

ACE-Step是由中国团队阶跃星辰(StepFun)与ACE Studio联手打造的开源音乐生成模型。 它拥有3.5B参数量,支持快速高质量生成、强可控性和易于拓展的特点。 最厉害的是,它可以生成多种语言的歌曲,包括但不限于中文、英文、日文等19种语言

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值