TransWikia.com

How to set the CRON for every 4 hours?

Magento Asked on December 9, 2021

I have created a custom cron group and below is the code.

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/cron_groups.xsd">
    <group id="MyCronJob">
        <schedule_generate_every>1</schedule_generate_every>
        <schedule_ahead_for>4</schedule_ahead_for>
        <schedule_lifetime>2</schedule_lifetime>
        <history_cleanup_every>10</history_cleanup_every>
        <history_success_lifetime>60</history_success_lifetime>
        <history_failure_lifetime>600</history_failure_lifetime>
        <use_separate_process>1</use_separate_process>
    </group>
</config>

In the cron group, I’m having 6 job instances and I want to generate the CRON for every 4 hours. so, I have updated the job instance as below

<job name="test_cron" instance="vendormoduleCrontest" method="execute">
            <schedule>0 */4 * * *</schedule>
</job>

Now my question is, in the CRON group, there is schedule_generate_every, so do I need to update the time in that portion as well and what is the difference which we are giving time in crontab and in crongroups.

Please guide and help.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP