【问题标题】:Cron Job - Read error (Connection timed out) in headersCron 作业 - 标头中的读取错误(连接超时)
【发布时间】:2014-05-27 14:00:09
【问题描述】:

我最近接管了一个在 EE(最新版本)中运行的网站。我的 EE 知识并不令人惊奇,但是,这个项目是我开始使用它的方式。

有问题的网站还使用 SPEKTRIX 来管理在他们的场地上发生的一大堆事情。它还使用 DataGrab 运行一些导入,这些导入会自动使用 EE 站点创建实例,供管理人员编辑和打开等...

这些 DataGrab 作业作为 Cron 作业运行,并且工作正常。但是,最近我在其中一个脚本中遇到了这些错误。

--2014-05-27 07:05:01--  http://www.domain.co.uk/spektrix/auto-import
Resolving www.domain.co.uk... xxx.xx.xxx.x
Connecting to www.domain.co.uk|xxx.xx.xx.x|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://www.domain.co.uk/spektrix/instances-import [following]

--2014-05-27 07:05:47--  http://www.domain.co.uk/spektrix/instances-import
Reusing existing connection to www.domain.co.uk:80.
HTTP request sent, awaiting response... Read error (Connection timed out) in headers.
Retrying.

--2014-05-27 07:20:48-- (try: 2)  http://www.domain.co.uk/spektrix/instances-import
Connecting to www.domain.co.uk|xxx.xx.xxx.x|:80... connected.
HTTP request sent, awaiting response... Read error (Connection timed out) in headers.
Retrying. 

我不知道为什么当同一个脚本给出以下响应时突然开始播放

--2014-05-24 09:05:01--  http://www.domain.co.uk/spektrix/auto-import
Resolving www.domain.co.uk... xxx.xx.xxx.x
Connecting to www.domain.co.uk|xxx.xx.xxx.x|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://www.domain.co.uk/spektrix/instances-import [following]

--2014-05-24 09:05:19--  http://www.domain.co.uk/spektrix/instances-import
Reusing existing connection to www.domain.co.uk:80.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: `auto-import.531'

0K .......... .......... .......... .......... ..........  134M
50K .......... .                                           21387G=0s

2014-05-24 09:13:57 (165 MB/s) - `auto-import.531' saved [62682] 

如果这些人提供任何帮助,我们将不胜感激

谢谢

/* 更新 */

它通过 cpanel 使用 wget 来运行脚本

5 0 * * * wget 'http://www.domain.co.uk/assets/auto/set-expiry-date.php'

5 * * * * wget 'http://www.domain.co.uk/spektrix/auto-import'

0 * * * * wget 'http://www.domain.co.uk/assets/auto/extend-expiry-date.php'

自动导入是唯一有超时问题的。

另外值得注意的是,当超时发生时会导致服务器具有较高的 CPU/内存负载。

我已重新启动 cron 并等待作业重新启动并在 cron 运行时运行命令“top”

PID  USER    PR  NI  VIRT  RES  SHR  S %CPU   %MEM  TIME+     COMMAND           
1617 mysql   20  0 3 450m  244m 6008 S 234.1  1.2   17048:40  mysqld

【问题讨论】:

    标签: cron cpanel


    【解决方案1】:

    如报错所示,请求超时。你知道用什么工具来获取这些信息吗?输出看起来像 curl 并且 curl 有一个 --connect-timeout 选项,您可以使用它来提高超时值。默认为 5 分钟;尝试将其延长 10 分钟,看看它是否能解决错误。

    【讨论】:

    • 相同的选项(--connect-timeout=seconds)适用于 wget
    • 其实是 wget - 我通过 cpanel 设置好了
    • 您是否添加了选项(--connect-timeout=seconds)并重试?
    猜你喜欢
    • 1970-01-01
    • 2013-08-07
    • 1970-01-01
    • 2017-04-01
    • 1970-01-01
    • 2018-10-15
    • 2015-03-15
    • 2017-12-10
    • 2016-01-29
    相关资源
    最近更新 更多