免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 5568 | 回复: 7
打印 上一主题 下一主题

[网络相关] wget使用问题postdata [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2014-02-26 14:20 |只看该作者 |倒序浏览
/usr/bin/wget --http-user=user --http-password=passwd --header 'Content-Type:text/plain;charset=UTF-8' --post-data 'U   1001/d' --output-document - --timeout=2 'http://host.jenkins.com/subversion/8b0adc08-4d01-4dc5-8d0f-1063f083dcbf/notifyCommit?rev=79825'

--13:46:19--  http://host.jenkins.com/subversi ... ifyCommit?rev=79825
           => `-'
Resolving host.jenkins.com... 10.38.22.81
Connecting to  host.jenkins.com|10.38.22.81|:80... connected.
HTTP request sent, awaiting response... Read error (Connection timed out) in headers.
Retrying.

--13:49:23--  http://host.jenkins.com/subversi ... ifyCommit?rev=79825
  (try:20) => `-'
Connecting to host.jenkins.com|10.38.22.81|:80... connected.
HTTP request sent, awaiting response... Read error (Connection timed out) in headers.
Giving up.

一直发送请求,已经成功还是会继续try  一直到try20次才结束。咋设置,执行成功就不再try了呀

论坛徽章:
33
荣誉会员
日期:2011-11-23 16:44:17天秤座
日期:2014-08-26 16:18:20天秤座
日期:2014-08-29 10:12:18丑牛
日期:2014-08-29 16:06:45丑牛
日期:2014-09-03 10:28:58射手座
日期:2014-09-03 16:01:17寅虎
日期:2014-09-11 14:24:21天蝎座
日期:2014-09-17 08:33:55IT运维版块每日发帖之星
日期:2016-04-17 06:23:27操作系统版块每日发帖之星
日期:2016-04-18 06:20:00IT运维版块每日发帖之星
日期:2016-04-24 06:20:0015-16赛季CBA联赛之天津
日期:2016-05-06 12:46:59
2 [报告]
发表于 2014-02-26 14:42 |只看该作者
两个办法, 一个是你的服务端要返回正确的 code, 现在看, 好象服务端啥也没返回.

另外, wget 是可以设置 retry 次数的.
  1.        -t number
  2.        --tries=number
  3.            Set number of retries to number.  Specify 0 or inf for infinite
  4.            retrying.  The default is to retry 20 times, with the exception of
  5.            fatal errors like "connection refused" or "not found" (404), which
  6.            are not retried.
复制代码

论坛徽章:
0
3 [报告]
发表于 2014-02-26 14:57 |只看该作者
回复 2# q1208c
请教下,--timeout参数的作用是?
-t好像是时间


   

论坛徽章:
33
荣誉会员
日期:2011-11-23 16:44:17天秤座
日期:2014-08-26 16:18:20天秤座
日期:2014-08-29 10:12:18丑牛
日期:2014-08-29 16:06:45丑牛
日期:2014-09-03 10:28:58射手座
日期:2014-09-03 16:01:17寅虎
日期:2014-09-11 14:24:21天蝎座
日期:2014-09-17 08:33:55IT运维版块每日发帖之星
日期:2016-04-17 06:23:27操作系统版块每日发帖之星
日期:2016-04-18 06:20:00IT运维版块每日发帖之星
日期:2016-04-24 06:20:0015-16赛季CBA联赛之天津
日期:2016-05-06 12:46:59
4 [报告]
发表于 2014-02-26 15:42 |只看该作者
回复 3# T_study
timeout 就是 超时呀. 如果到了超时还没有返回. 一般是用在 网络很差的时候, 防止脚本无限等下去.
   

论坛徽章:
0
5 [报告]
发表于 2014-02-26 16:28 |只看该作者
回复 4# q1208c

timeout=2 的意思是? 2分钟还是?

   

论坛徽章:
33
ChinaUnix元老
日期:2015-02-02 08:55:39CU十四周年纪念徽章
日期:2019-08-20 08:30:3720周年集字徽章-周	
日期:2020-10-28 14:13:3020周年集字徽章-20	
日期:2020-10-28 14:04:3019周年集字徽章-CU
日期:2019-09-08 23:26:2519周年集字徽章-19
日期:2019-08-27 13:31:262016科比退役纪念章
日期:2022-04-24 14:33:24
6 [报告]
发表于 2014-02-26 16:35 |只看该作者
回复 5# T_study
  1. man wget
复制代码

论坛徽章:
33
荣誉会员
日期:2011-11-23 16:44:17天秤座
日期:2014-08-26 16:18:20天秤座
日期:2014-08-29 10:12:18丑牛
日期:2014-08-29 16:06:45丑牛
日期:2014-09-03 10:28:58射手座
日期:2014-09-03 16:01:17寅虎
日期:2014-09-11 14:24:21天蝎座
日期:2014-09-17 08:33:55IT运维版块每日发帖之星
日期:2016-04-17 06:23:27操作系统版块每日发帖之星
日期:2016-04-18 06:20:00IT运维版块每日发帖之星
日期:2016-04-24 06:20:0015-16赛季CBA联赛之天津
日期:2016-05-06 12:46:59
7 [报告]
发表于 2014-02-26 16:44 |只看该作者
T_study 发表于 2014-02-26 16:28
回复 4# q1208c

timeout=2 的意思是? 2分钟还是?



单位好象是 秒.

论坛徽章:
29
程序设计版块每日发帖之星
日期:2016-02-29 06:20:0015-16赛季CBA联赛之天津
日期:2016-08-10 10:33:1115-16赛季CBA联赛之深圳
日期:2016-08-17 15:07:2015-16赛季CBA联赛之佛山
日期:2016-11-07 11:33:5015-16赛季CBA联赛之广夏
日期:2016-11-15 09:13:31CU十四周年纪念徽章
日期:2016-11-24 14:12:25极客徽章
日期:2016-12-07 14:03:4015-16赛季CBA联赛之深圳
日期:2016-12-07 17:15:2715-16赛季CBA联赛之北京
日期:2016-12-22 09:30:0115-16赛季CBA联赛之深圳
日期:2016-12-22 10:49:2115-16赛季CBA联赛之山西
日期:2017-02-10 09:05:3215-16赛季CBA联赛之同曦
日期:2017-02-27 14:19:08
8 [报告]
发表于 2014-02-26 22:38 |只看该作者
-T seconds
--timeout=seconds
Set the network timeout to seconds seconds.
-t number
--tries=number
Set number of retries to number
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP