1

I am trying to create a batch file that will connect slave node to master jenkins on boot.

I can successfully connect by manually typing:

java -jar slave.jar -jnlpUrl http://jenkinsURL:8080/jenkins/computer/Selenium%20Slave/slave-agent.jnlp -secret secret key

But when I try running the script that has the exact same command, it returns Failing to obtain http://jenkinsurl:8080/jenkins/computer/Selenium0Slave/slave-agent.jnlp?encrypt=true and fails to process the connection.

Batch script:

start cmd /k java -jar slave.jar -jnlpUrl http://jenkinsurl:8080/jenkins/computer/Selenium%20Slave/slave-agent.jnlp -secret secretkey

Why does it return different URL when executed with a batch file? If anyone has successfully done this I would really appreciate your feedback. Thanks!

jwdonahue
  • 6,199
  • 2
  • 21
  • 43
Danny Kim
  • 11
  • 4
  • 1
    The percent symbol is a special character in a batch file. To escape the percent symbol in a batch file you need to double the percent symbol in your code. – Squashman Oct 03 '18 at 18:14
  • @Squashman Oh you are right! I got it to work after re-naming the slave and editing the script accordingly. Thanks! – Danny Kim Oct 03 '18 at 18:37
  • Manual typing: "... secret key" but Batch script: "... secretkey" – pburgr Oct 10 '18 at 07:12

0 Answers0