I want to run my cron job every 2 hour for importing product . so i have use below code for that.

Using this code my first cron is run perfectly but i don't know when it will run second time ? is it run after two hour consider after completion of first one ?


i just need to run this cron while completion of my product ( 1000 number of product ) import every time. and it will take approx 2 hour to complete this import process of importing . so what i need to set value in this code ?

any idea please share !

If i set 15 minute then second cron is waiting till complete previous process then start after complete first process ?

  • Did you check the answer? May 3, 2018 at 7:56

1 Answer 1


Instead of changing default cron configuration, you'd better define your desired frequency in your concrete cron task configuration


<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
    <group id="default">
        <job name="custom_cronjob" instance="Magento\SampleMinimal\Cron\Test" method="execute">
            <schedule>* * * * *</schedule>

The preceding crontab.xml runs the Magento/SampleMinimal/Cron/Test.php class once per minute, resulting in a row being added to the cron_schedule table.


Verify your custom cron group

php /var/www/html/magento2/bin/magento cron:run --group="custom_crongroup"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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