【问题标题】:How to check whether jenkins is fully up and running using webservice ?如何使用 webservice 检查 jenkins 是否完全启动并运行?
【发布时间】:2012-06-12 10:05:07
【问题描述】:

我想知道,如何使用 webservice 检查 jenkins 是否完全启动并运行?

我想使用 jenkins 网络服务来检查这一点。有没有办法做到这一点?

谢谢。

【问题讨论】:

    标签: hudson jenkins command-line-interface


    【解决方案1】:

    可能最简单的方法是在 Jenkins 服务器根 URL 上执行简单的 HTTP 获取。如果 Jenkins 完全启动,您将获得成功状态 (200)。如果不是,您将得到 503 - Service Temporarily Unavailable(或可能其他错误,具体取决于具体情况)。

    您可以从命令行使用诸如wget 之类的工具来执行该请求。

    【讨论】:

      【解决方案2】:

      也可以使用 curl:

      while [[ $(curl -s -w "%{http_code}" http://server -o /dev/null) != "200" ]]; do
        sleep 5
      done
      

      【讨论】:

        【解决方案3】:

        除了之前的答案:如果启用了安全性,您将从根 URL 获得 HTTP 403。要获取 HTTP 200,您可以查看 http://server/login。

        【讨论】:

          猜你喜欢
          • 2021-12-07
          • 1970-01-01
          • 2016-05-23
          • 2021-04-09
          • 2022-12-03
          • 2020-05-02
          • 1970-01-01
          • 1970-01-01
          • 2016-09-28
          相关资源
          最近更新 更多