Magento 1.8 Cron – Setting Up Cron to Run Every 30 Minutes

cronmagento-1.8

I want to create a cron that runs every 30 minutes.

I am using another cron as an example – I have created the cron in a config.xml file, not using the admin interface.

The example I am using is the following:

<tracking_cron>
    <schedule><cron_expr>0 4 * * *</cron_expr></schedule>
    <run>
        <model>tracking/observer::cron</model>
    </run>
</tracking_cron>

My questions are as follows:

1) On what intervals is the above cron being run?

2) What would the cron_expr be for a cron that should run every 30 minutes?

Best Answer

The Current cron expression you have added <cron_expr>0 4 * * *</cron_expr> will run every day at 04:00 AM

next at 2017-03-23 04:00:00
then at 2017-03-24 04:00:00
then at 2017-03-25 04:00:00
then at 2017-03-26 04:00:00
then at 2017-03-27 04:00:00

If You want it for every 30 minutes you can add expression as

<cron_expr>*/30 * * * *</cron_expr>

next at 2017-03-22 14:30:00
then at 2017-03-22 15:00:00
then at 2017-03-22 15:30:00
then at 2017-03-22 16:00:00
then at 2017-03-22 16:30:00

You can test expression from this reference site

Related Topic