How to check running job on self-hosted Azure DevOps Agent on Linux via bash

Viewed 362
1 Answers

I found a solution by reading the status of the agent service:

Go to folder where you installed the agent and run -

./svc.sh status | tail -n1 | grep -c -e "Running"

  1. Get the agent status
  2. Get the last line
  3. Check if the last line contains the word Running. If not, the return code will be 0, and you know, that there is not any job currently running on Agent. Otherwise, the return code of the command will be >=1.
Related