简体   繁体   English

如何在Jenkins中使用CURL命令检索状态代码?

[英]How to use CURL command inside Jenkins for retrieving status code?

I am using CURL command in jenkins for retrieving "status code" of an ip. 我在詹金斯中使用CURL命令来检索ip的“状态代码”。 I did the following command in terminal and it is working properly. 我在终端中执行了以下命令,它可以正常工作。

curl -i ip_address:port curl -i ip_address:端口

Output of terminal 端子输出

HTTP/1.1 200 OK HTTP / 1.1 200 OK

But in the case of jenkins, 但是对于詹金斯来说

I added the above command inside "Execute shell" It is the giving error with the following output. 我在“执行外壳”中添加了上面的命令,这是给出错误的以下输出。

curl -i ip_address:port curl -i ip_address:端口

% Total % Received % Xferd AverageDload Speed Upload TimeTotal %总计%接收的%Xferd平均加载速度上传时间总计

0 0 0 0 0 --:--:-- 0 0 0 0 0-:-:-
TimeSpent TimeLeft CurrentSpeed 时间消耗时间左电流速度

--:--:-- --:--:-- --:--:-- -:-:--:-:--:-:-
curl: Failed to connect to ip_address port : Connection refused curl:无法连接到ip_address端口:连接被拒绝

Can anyone suggest a solution for the same? 任何人都可以提出解决方案吗?

这实际上不是詹金斯问题/答案,但是请尝试以下操作:

curl -i -s IP:port/path

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM