- 论坛徽章:
- 0
|
本帖最后由 personball 于 2012-08-22 14:44 编辑
curl 有超时选项的,自己去找男人man一下回复 9# ztj2247
--connect-timeout <seconds>
Maximum time in seconds that you allow the connection to the
server to take. This only limits the connection phase, once
curl has connected this option is of no more use. See also the
-m, --max-time option.
-m, --max-time <seconds>
Maximum time in seconds that you allow the whole operation to
take. This is useful for preventing your batch jobs from hang‐
ing for hours due to slow networks or links going down. See
also the --connect-timeout option.
断点续传
-C, --continue-at <offset>
Continue/Resume a previous file transfer at the given offset.
The given offset is the exact number of bytes that will be
skipped, counting from the beginning of the source file before
it is transferred to the destination. If used with uploads, the
FTP server command SIZE will not be used by curl.
Use "-C -" to tell curl to automatically find out where/how to
resume the transfer. It then uses the given output/input files
to figure that out.
If this option is used several times, the last one will be used.
重试次数,间隔及时长:
--retry <num>
If a transient error is returned when curl tries to perform a
transfer, it will retry this number of times before giving up.
Setting the number to 0 makes curl do no retries (which is the
default). Transient error means either: a timeout, an FTP 4xx
response code or an HTTP 5xx response code.
When curl is about to retry a transfer, it will first wait one
second and then for all forthcoming retries it will double the
waiting time until it reaches 10 minutes which then will be the
delay between the rest of the retries. By using --retry-delay
you disable this exponential backoff algorithm. See also
--retry-max-time to limit the total time allowed for retries.
(Added in 7.12.3)
If this option is used multiple times, the last occurrence
decide the amount.
--retry-delay <seconds>
Make curl sleep this amount of time before each retry when a
transfer has failed with a transient error (it changes the
default backoff time algorithm between retries). This option is
only interesting if --retry is also used. Setting this delay to
zero will make curl use the default backoff time. (Added in
7.12.3)
If this option is used multiple times, the last occurrence
determines the amount.
--retry-max-time <seconds>
The retry timer is reset before the first transfer attempt.
Retries will be done as usual (see --retry) as long as the timer
hasn't reached this given limit. Notice that if the timer hasn't
reached the limit, the request will be made and while perform‐
ing, it may take longer than this given time period. To limit a
single request′s maximum time, use -m, --max-time. Set this
option to zero to not timeout retries. (Added in 7.12.3)
If this option is used multiple times, the last occurrence
determines the amount.
|
|