【问题标题】:Cron task not working on magento 1.9.2Cron 任务不适用于 magento 1.9.2
【发布时间】:2016-12-19 01:04:12
【问题描述】:

我一直在尝试在 magento 站点(在子域上)运行 cron 任务

Magento 版本:1.9.2.4 PHP : 5.6

我已经从我的 c-panel cron 选项卡中尝试了以下选项

为 cron.php 文件设置 777 权限

选项 1:

*/15 * * * * php -q /home/XXXX/public_html/newmagento/cron.php

选项 2:

0,30 * * * * /bin/sh /home/XXXX/public_html/newmagento/cron.sh

选项 3:

0 * * * * php /home/XXXX/public_html/newmagento/cron.php


但我无法让它与任何选项一起使用

** 对电子邮件中收到的 crons 的响应:**

选项 1:

访问被拒绝。

选项 3:

X-Powered-By:PHP/5.6.14

内容类型:文本/html; charset=UTF-8

访问被拒绝。

选项 2 没有电子邮件回复


看完cmets安装的'aoe scheduler'

未找到心跳任务。检查 cron 是否配置正确。 (见说明)

我按照 AOE 调度程序的指示修改了 cron(来自 c-panel):

          • ! test -e /home/XXXX/public_html/newmagento/maintenance.flag && /bin/bash /home/XXXX/public_html/newmagento/scheduler_cron.sh --mode always --includeGroups my_queue_jobs
          • ! test -e /home/XXXX/public_html/newmagento/maintenance.flag && /bin/bash /home/XXXX/public_html/newmagento/scheduler_cron.sh --mode always --excludeGroups my_queue_jobs
          • ! test -e /home/XXXX/public_html/newmagento/maintenance.flag && /bin/bash /home/XXXX/public_html/newmagento/scheduler_cron.sh --mode default --includeGroups groupA,groupB
          • ! test -e /home/XXXX/public_html/newmagento/maintenance.flag && /bin/bash /home/XXXX/public_html/newmagento/scheduler_cron.sh --mode default --includeGroups groupC
          • ! test -e /home/XXXX/public_html/newmagento/maintenance.flag && /bin/bash /home/XXXX/public_html/newmagento/scheduler_cron.sh --mode default --excludeGroups groupA,groupB,groupC */10 * * * * ! test -e /home/XXXX/public_html/newmagento/maintenance.flag && cd /home/XXXX/public_html/newmagento/shell && /usr/bin/php scheduler.php --action watchdog

完成所有操作后,我在电子邮件中得到了以下结果

! test -e /home/XXXX/public_html/newmagento/maintenance.flag && /bin/bash /home/XXXX/public_html/newmagento/scheduler_cron.sh --mode always --includeGroups my_queue_jobs

/home/XXXX/public_html/newmagento/scheduler_cron.sh: fork: retry: 资源暂时不可用 /home/XXXX/public_html/newmagento/scheduler_cron.sh: fork: retry: 资源暂时不可用 /home/XXXX/public_html/newmagento/scheduler_cron.sh:fork:重试:资源 暂时不可用 /home/XXXX/public_html/newmagento/scheduler_cron.sh: fork: retry: 资源暂时不可用 /home/XXXX/public_html/newmagento/scheduler_cron.sh:fork:资源暂时不可用 找不到 php 的二进制文件

! test -e /home/XXXX/public_html/newmagento/maintenance.flag && /bin/bash /home/XXXX/public_html/newmagento/scheduler_cron.sh --mode always --excludeGroups my_queue_jobs

/home/XXXX/public_html/newmagento/scheduler_cron.sh: fork: retry: 资源暂时不可用 /home/XXXX/public_html/newmagento/scheduler_cron.sh: fork: retry: 资源暂时不可用 /home/XXXX/public_html/newmagento/scheduler_cron.sh: fork: retry: 资源暂时不可用 /home/XXXX/public_html/newmagento/scheduler_cron.sh: fork: retry: 资源暂时不可用 /home/XXXX/public_html/newmagento/scheduler_cron.sh:fork:资源暂时不可用

! test -e /home/XXXX/public_html/newmagento/maintenance.flag && /bin/bash /home/XXXX/public_html/newmagento/scheduler_cron.sh --mode default --includeGroups groupC

/home/XXXX/public_html/newmagento/scheduler_cron.sh: fork: retry: 资源暂时不可用 /home/XXXX/public_html/newmagento/scheduler_cron.sh: fork: retry: 资源暂时不可用 /home/XXXX/public_html/newmagento/scheduler_cron.sh: fork: retry: 资源暂时不可用 /home/XXXX/public_html/newmagento/scheduler_cron.sh: fork: retry: 资源暂时不可用 /home/XXXX/public_html/newmagento/scheduler_cron.sh:fork:资源暂时不可用

! test -e /home/XXXX/public_html/newmagento/maintenance.flag && /bin/bash /home/XXXX/public_html/newmagento/scheduler_cron.sh --mode default --includeGroups groupA,groupB

/home/XXXX/public_html/newmagento/scheduler_cron.sh: fork: retry: 资源暂时不可用 /home/XXXX/public_html/newmagento/scheduler_cron.sh: fork: retry: 资源暂时不可用 /home/XXXX/public_html/newmagento/scheduler_cron.sh: fork: retry: 资源暂时不可用 /home/XXXX/public_html/newmagento/scheduler_cron.sh: fork: retry: 资源暂时不可用 /home/XXXX/public_html/newmagento/scheduler_cron.sh:fork:资源暂时不可用

! test -e /home/XXXX/public_html/newmagento/maintenance.flag && /bin/bash /home/XXXX/public_html/newmagento/scheduler_cron.sh --mode default --excludeGroups groupA,groupB,groupC

/bin/bash: fork: retry: Resource temporarily unavailable
/bin/bash: fork: retry: Resource temporarily unavailable
/bin/bash: fork: retry: Resource temporarily unavailable
/bin/bash: fork: retry: Resource temporarily unavailable
/home/XXXX/public_html/newmagento/scheduler_cron.sh: fork: retry: Resource temporarily unavailable
Status: 500 Internal Server Error
X-Powered-By: PHP/5.6.14
Content-type: text/html; charset=UTF-8 

! test -e /home/XXXX/public_html/newmagento/maintenance.flag && cd /home/XXXX/public_html/newmagento/shell && /usr/bin/php scheduler.php --action watchdog

Status: 500 Internal Server Error
X-Powered-By: PHP/5.6.14
Content-type: text/html; charset=UTF-8

【问题讨论】:

标签: php magento cron


【解决方案1】:

尝试输出到日志文件以捕获类似的错误

0,30 * * * * /bin/sh /home/XXXX/public_html/newmagento/cron.sh >> path_to/magneto/var/filename.log

最好使用 magento var log 文件夹中的日志文件。

当您选择运行 cron.php 文件时,请确保 php 二进制文件并将其与路径一起使用。要查找路径,请使用以下命令

>which php

【讨论】:

  • 我也会试试这个。
  • 服务器上的 php 路径是 /usr/local/bin/php ,我想把它放在你建议的命令中
  • 试试这个 */15 * * * * /usr/local/bin/php -f /home/XXXX/public_html/newmagento/cron.php
  • 您也可以尝试从提示中手动调用 cron 文件,例如 >/usr/local/bin/php -f /home/XXXX/public_html/newmagento/cron.php 或 >sh /home/ XXXX/public_html/newmagento/cron.sh
  • 我尝试从命令提示符运行它:sh /home/xxx/public_html/newmagento/cron.sh 和 /usr/local/bin/php -f /home/xxxx/public_html/newmagento/cron .php,但在终端、电子邮件中没有收到任何消息,cron 也没有工作
猜你喜欢
  • 2014-04-26
  • 2014-10-17
  • 2011-09-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-10-26
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多