I have two Windows 10 machines on which I want to run the agent. The first machine works without problems, but on the second machine the agent does not want to stay active.
I have set up the start of the agent via a batch in the task scheduler. On the first machine the batch starts when the machine is started, on the second machine the batch is also started, but is immediately closed as successful again. (action “C:\Windows\SYSTEM32\cmd.exe” with return code 0.)
Does anyone know this phenomenon? The machines are set up identically and also the tasks in the scheduler are set up identically.
Unfortunately, there is no log.
I only have the message from the task scheduler that the task was successfully completed.
If I start the batch manually everything works. Only the Task Scheduler does not leave it open but simply closes it.
The batch is configured identically as on machine 1. Of course, the name and the secret key is adjusted.
What about Java version on each machine? You say there is not a log, but the scheduled task succeeds? Does your bat file exit /b %ERRORLEVEL% after the java line?
Add some echo steps before the java call and redirect them to a file. If the file exists you know that the batch is called properly.
redirect the output of the java call to a log file. The task scheduler is not capturing the output so if there is a problem in starting up java itself you will never find out what the cause is.
I’ve edited the batch and got a agent.log. But there ist only 1 Line:
“Starting Jenkins agent”
Even when I start the batch by hand.
I’ve deleted the first line “echo Start Jenkins…”, but the redirect to the log for the java line is still there.
When I restart the machine, the logfile will created but it is empty