top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to enable cron in Magento?

+3 votes
445 views
How to enable cron in Magento?
posted Apr 22, 2015 by Rahul Singh

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

+1 vote

In Magento we can schedule custom tasks in our XML configuration, in a similar manner to the UNIX crontab style.
Like in app/code/core/Mage/CatalogRule/etc/config.xml:

<config>
    <crontab>
            <jobs>
                <catalogrule_apply_all>
                    <schedule><cron_expr>0 1 * * *</cron_expr></schedule>
                    <run><model>catalogrule/observer::dailyCatalogUpdate</model></run>
                </catalogrule_apply_all>
            </jobs>
    </crontab>
</config>

This example will run Mage_CatalogRule_Model_Observer::dailyCatalogUpdate method every day at 01:00am (0 1 * * *).

To execute these configured tasks, there is a cron.php file located in the Magento root and it need to be run periodically,like every 15 minutes. Basically, these script will check that if it needs to run any tasks, and if it needs to schedule any future tasks.

In UNIX/BSD/linux systems we need to add this line in our crontab:

*/10 * * * *  /bin/sh /absolute/path/to/magento/cron.sh
answer Oct 26, 2015 by Vrije Mani Upadhyay
0 votes

In the Magento admin, go to: System > Sonfiguration > System > Cron (Scheduled Tasks) and configure cron jobs you wish to run.

You should know that Magento runs cron jobs even if you don't have a daily cron job configured. Whenever Magento receives a request, it checks if there are any cron jobs to be run. Therefore, having the daily cron job would only make sense if you had no requests for an entire day.

Really there is no next step to be done. I recommend you read http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/how_to_setup_a_cron_job

answer Apr 22, 2015 by Amit Kumar Pandey
...