[英]How to check running job on self-hosted Azure DevOps Agent on Linux via bash
I have installed the Azure DevOps agent on my Linux Ubuntu (Ubuntu 20.04.3 LTS) machine - https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/v2-linux?view=azure-devops .我已经在我的 Linux Ubuntu(Ubuntu 20.04.3 LTS)机器上安装了 Azure DevOps 代理 - https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/v2-linux?view=azure-开发者。
Now I want to write a script, which will check if there is some job (pipeline) running on an agent.现在我想编写一个脚本,它将检查代理上是否有一些作业(管道)正在运行。
Is it possible to somehow check whether there is a job running on the agent via bash on Linux, where is the agent installed?是否可以通过 Linux 上的 bash 以某种方式检查代理上是否正在运行作业,代理安装在哪里? Without API calls to Azure DevOps.
没有对 Azure DevOps 的 API 调用。
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"
Running
.Running
。 If not, the return code will be 0, and you know, that there is not any job currently running on Agent.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.