简体   繁体   English

Cron任务不适用于magento 1.9.2

[英]Cron task not working on magento 1.9.2

I have been trying running a cron task on magento site ( on a sub-domain ) 我一直在尝试在magento网站(子域)上执行cron任务

Magento version : 1.9.2.4 
PHP  :  5.6

I have tried the following option from my c-panel cron tab 我从c面板cron选项卡中尝试了以下选项

Set 777 permssions for cron.php file 为cron.php文件设置777权限

Option 1 : 选项1 :

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

Option 2 : 选项2:

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

Option 3: 选项3:

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


But i couldn't get it working with any of the option 但是我无法使其与任何选项一起使用

** Response for the crons received in email :** **通过电子邮件收到的克朗回复:**

Option 1 : 选项1 :

Access denied. 拒绝访问。

Option 3 : 选项3:

X-Powered-By: PHP/5.6.14 X-Powered-By:PHP / 5.6.14

Content-type: text/html; 内容类型:text / html; charset=UTF-8 字符集= UTF-8

Access denied. 拒绝访问。

There is no email response for option 2 选项2没有电子邮件回复


After reading the comments installed 'aoe scheduler' 看完评论后安装“ aoe scheduler”

No heartbeat task found. 找不到心跳任务。 Check if cron is configured correctly. 检查cron配置是否正确。 (See Instructions) (请参阅说明)

I modified cron ( from c-panel) as insrtructed by AOE scheduler as : 我将cron(来自c-panel)修改为由AOE调度程序指示为:

          • ! 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 测试-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 测试-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 测试-e /home/XXXX/public_html/newmagento/maintenance.flag && / bin / bash /home/XXXX/public_html/newmagento/scheduler_cron.sh --mode默认--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 测试-e /home/XXXX/public_html/newmagento/maintenance.flag && / bin / bash /home/XXXX/public_html/newmagento/scheduler_cron.sh --mode默认--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 * * * * ! 测试-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 测试-e /home/XXXX/public_html/newmagento/maintenance.flag && cd / home / XXXX / public_html / newmagento / shell && / usr / bin / php scheduler.php --action看门狗

After doing all that i got the following results in email 完成所有这些操作后,我在电子邮件中得到以下结果

! 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 测试-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: Resource temporarily unavailable

/home/XXXX/public_html/newmagento/scheduler_cron.sh: fork: retry: Resource temporarily unavailable

/home/XXXX/public_html/newmagento/scheduler_cron.sh: fork: retry: Resource 
temporarily unavailable

/home/XXXX/public_html/newmagento/scheduler_cron.sh: fork: retry: Resource temporarily unavailable

/home/XXXX/public_html/newmagento/scheduler_cron.sh: fork: Resource temporarily unavailable

Could not find a binary for 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 测试-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: Resource temporarily unavailable
    /home/XXXX/public_html/newmagento/scheduler_cron.sh: fork: retry: Resource temporarily unavailable
    /home/XXXX/public_html/newmagento/scheduler_cron.sh: fork: retry: Resource temporarily unavailable
    /home/XXXX/public_html/newmagento/scheduler_cron.sh: fork: retry: Resource temporarily unavailable
    /home/XXXX/public_html/newmagento/scheduler_cron.sh: fork: Resource temporarily unavailable

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

/home/XXXX/public_html/newmagento/scheduler_cron.sh: fork: retry: Resource temporarily unavailable
/home/XXXX/public_html/newmagento/scheduler_cron.sh: fork: retry: Resource temporarily unavailable
/home/XXXX/public_html/newmagento/scheduler_cron.sh: fork: retry: Resource temporarily unavailable
/home/XXXX/public_html/newmagento/scheduler_cron.sh: fork: retry: Resource temporarily unavailable
/home/XXXX/public_html/newmagento/scheduler_cron.sh: fork: Resource temporarily unavailable

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

/home/XXXX/public_html/newmagento/scheduler_cron.sh: fork: retry: Resource temporarily unavailable
/home/XXXX/public_html/newmagento/scheduler_cron.sh: fork: retry: Resource temporarily unavailable
/home/XXXX/public_html/newmagento/scheduler_cron.sh: fork: retry: Resource temporarily unavailable
/home/XXXX/public_html/newmagento/scheduler_cron.sh: fork: retry: Resource temporarily unavailable
/home/XXXX/public_html/newmagento/scheduler_cron.sh: fork: Resource temporarily unavailable

! 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 测试-e /home/XXXX/public_html/newmagento/maintenance.flag && / bin / bash /home/XXXX/public_html/newmagento/scheduler_cron.sh --mode默认--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 测试-e /home/XXXX/public_html/newmagento/maintenance.flag && cd / home / XXXX / public_html / newmagento / shell && / usr / bin / php scheduler.php --action看门狗

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

Try outputting to log file to trap error like 尝试输出到日志文件以捕获错误,例如

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

It will be ideal to use the a log file in magento var log folder. 最好使用magento var日志文件夹中的日志文件。

When you choose to run the cron.php file do make sure of the php binary and use it with the path. 当您选择运行cron.php文件时,请确保php二进制文件并与路径一起使用。 To find the path use the following command 要找到路径,请使用以下命令

>which php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM