linux - WGET 是否超时?

我正在使用 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

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

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

https://stackoverflow.com/questions/2291524/

相关文章:

python - 在python中调用带有参数列表的函数

linux - 如何连接两个字符串以构建完整路径

python - 了解python的主要方法

python - 如何查看安装了哪个版本的nltk、scikit learn?

python - 为什么字典和集合中的顺序是任意的?

python - 如何中止 Python 脚本的执行?

linux - 如何在 Linux 上的某个时间运行脚本?

python - 更新不同深度的嵌套字典的值

linux - tar:添加当前目录中的所有文件和目录,包括 .svn 等

python - Jinja2 简写条件