简体   繁体   中英

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 version : 1.9.2.4 
PHP  :  5.6

I have tried the following option from my c-panel cron tab

Set 777 permssions for cron.php file

Option 1 :

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

Option 2 :

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

Option 3:

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 :

Access denied.

Option 3 :

X-Powered-By: PHP/5.6.14

Content-type: text/html; charset=UTF-8

Access denied.

There is no email response for option 2


After reading the comments installed 'aoe scheduler'

No heartbeat task found. Check if cron is configured correctly. (See Instructions)

I modified cron ( from c-panel) as insrtructed by AOE scheduler as :

          • ! 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

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

/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

/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

/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

/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

/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

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

It will be ideal to use the a log file in magento var log folder.

When you choose to run the cron.php file do make sure of the php binary and use it with the path. To find the path use the following command

>which php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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