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?

14

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

  • 2
    I bookmarked that site, it's exactly what I needed - I searched extensively but nowhere coudl I actually find anything that explained it to me, than you very much! – Skytiger Mar 22 '17 at 9:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.