3
votes

I am using the "Send files or execute commands over SSH after the build runs" option in my Jenkins job configuration. I am running a .bat file on a remote server. The .bat file is starting an authentication server. The authentication server needs to remain up and running on the remote server.

The authentication server is delivered with a .bat file to start and stop the server. When I run the delivered .bat file my jenkins job hangs and never completes. The delivered .bat file named startAuth.bat looks like this:

call java -jar Auth.jar db migrate Auth.yml
call java -jar Auth.jar server Auth.yml

Based on some end user restrictions, I cannot modify the startAuth.bat file, so I have create another .bat file to call startAuth.bat named runStartAuth.bat. It looks like this:

cd c:\tmp
start runStartAuth.bat
exit /b

My thinking was by using "start" the .bat should be run in a separate process, one that could remain up and running until the next Jenkins job run, and the calling .bat would exit with the exit /b line. Unfortunately, the Jenkins job seems to ignore the exit and just spins and spins.

What am I doing wrong?

1

1 Answers

0
votes

I'm not really an expert with Jenkins ... but I think since the slave agent JVM wrapper over your batch file knows that the child process has not yet finished, it will not return control to the executor.

Instead, can you try having the same commands on the Jenkins slave node configuration ? I believe you will have slave launcher prefix command in the Advanced section of the slave node.