gpt4 book ai didi

linux - WGET 是否超时?

转载 作者:IT老高 更新时间:2023-10-28 12:26:33 24 4
gpt4 key购买 nike

我正在使用 Wget 通过 cron 运行 PHP 脚本,使用以下命令:

wget -O - -q -t 1 http://www.example.com/cron/run

脚本最多需要 5-6 分钟来处理。 WGet 会等待它并给它所需的所有时间,还是会超时?

最佳答案

根据the man page of wget ,有几个与超时相关的选项——默认读取超时为 900 秒——所以我说,是的,它可能会超时。


以下是有问题的选项:

-T seconds
--timeout=seconds

Set the network timeout to seconds seconds. This is equivalent to specifying --dns-timeout, --connect-timeout, and --read-timeout, all at the same time.


对于这三个选项:

--dns-timeout=seconds

Set the DNS lookup timeout to seconds seconds.
DNS lookups that don't complete within the specified time will fail.
By default, there is no timeout on DNS lookups, other than that implemented by system libraries.

--connect-timeout=seconds

Set the connect timeout to seconds seconds.
TCP connections that take longer to establish will be aborted.
By default, there is no connect timeout, other than that implemented by system libraries.

--read-timeout=seconds

Set the read (and write) timeout to seconds seconds.
The "time" of this timeout refers to idle time: if, at any point in the download, no data is received for more than the specified number of seconds, reading fails and the download is restarted.
This option does not directly affect the duration of the entire download.


我想使用类似

wget -O - -q -t 1 --timeout=600 http://www.example.com/cron/run

应确保在超过脚本持续时间之前没有超时。

(是的,这可能是最残酷的解决方案^^)

关于linux - WGET 是否超时?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2291524/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com