Search code examples
azure-devopsazure-pipelinesagent

Stop/restart active session of VSTS agent interactive mode


I have a VSTS build agent that runs in interactive mode, the server that agent is running on restarted it self as a part of windows upgrade, when I went on the server to start the agent, by typing "run.cmd" I have the message stating that I already have an active session

PS C:\agent> .\run.cmd
Scanning for tool capabilities.
Connecting to the server.
A session for this agent already exists.
2018-06-25 14:36:28Z: Agent connect error: The task agent <SERVER_NAME> already 
has an active session for owner <SERVER_NAME>.. Retrying until reconnected.

the problem is that even if the agent is stating it is active none of the selenium scripts are running property.

Does anyone know the command to kill that session and start it again. beside the command

config.cmd remove 

and going through the configuration process again?

I know if I would had the agent run as a service I can easily restart the service, but how do I do the same thing with an agent that is configured for interactive mode. thank you.


Solution

  • For the message you got as below, that means the agent has already online. It’s unnecessary to execute run.cmd again.

    A session for this agent already exists.
    2018-06-25 14:36:28Z: Agent connect error: The task agent <SERVER_NAME> already 
    has an active session for owner <SERVER_NAME>.. Retrying until reconnected.
    

    And you can double check in Agent pools page (https://account.visualstudio.com/_settings/agentpools) -> select the agent pool -> then you will find the agent state is Online.

    enter image description here

    BTW: if you want to stop the agent, you can end the task for Agent.Listener.exe in Task Manager, and the agent state in VSTS Agent pools page will change to Offline correspondingly.

    enter image description here