How to make curl reconnect after 60"?

0

Sometimes, curl freezes:

$ curl -O 'http://www.site.com/index.html'

  www.site.com/index.html --> index.html
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:02:17 --:--:--     0^C

After waiting for 137", I hit Ctrl-C, and re-download.


$ curl -O 'http://www.site.com/index.html'

  www.site.com/index.html --> index.html
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 49045    0 49045    0     0   4598      0 --:--:--  0:00:10 --:--:--  6078

It just takes 10" to download.


It sounds like, curl is waiting for response for ever.
How to make curl reconnect automatically after 60"?

kev

Posted 2012-05-12T13:50:55.133

Reputation: 9 972

Answers

0

retry 3 times, each time 60" at most:

curl -O --retry 3 -m 60 'http://www.site.com/index.html'

kev

Posted 2012-05-12T13:50:55.133

Reputation: 9 972