I hope this message finds you well.
I am currently building a Jenkins environment on a Windows server. I would like to register another Windows server as a node and run jobs on that server.
To launch the agent, I have been using the following command in the command prompt (CMD):
java -jar agent.jar -url http://10.10.10.10:8080/ -secret 1010101010 -name “test_1” -webSocket -workDir “c:\jenkins”
This command works temporarily, but once I close the CMD window, the connection is lost.
Is there a recommended way to keep the Jenkins agent running or start it automatically without keeping CMD open?
Any advice would be greatly appreciated.
You can install the agent as a service (there is a menu option in the GUI of the agent process to do so). One thing to note is that if you need the jobs to interact with the desktop at all, running as a service will not work. Services are not allowed to interact with the desktop.
Thank you for your response.
I was hoping to run the agent under a specific user context, so I understand that running it as a service would not be suitable in that case—especially if the job needs to interact with the desktop.
Does this mean that the only option is to keep the command prompt window open if I want to run the agent interactively under a user session?
1 Like