0

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 ?

        <schedule_generate_every>120</schedule_generate_every>
        <schedule_ahead_for>120</schedule_ahead_for>
        <schedule_lifetime>20</schedule_lifetime>
        <history_cleanup_every>10080</history_cleanup_every>
        <history_success_lifetime>21600</history_success_lifetime>
        <history_failure_lifetime>21600</history_failure_lifetime>
    <use_separate_process>1</use_separate_process>

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 ?

 <schedule_generate_every>15</schedule_generate_every>
 <schedule_ahead_for>15</schedule_ahead_for>
1
  • Did you check the answer? May 3, 2018 at 7:56

1 Answer 1

0

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

http://devdocs.magento.com/guides/v2.0/config-guide/cron/custom-cron-tut.html#cron-tut-crontab

<?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>
        </job>
    </group>
</config>

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.

update

Verify your custom cron group

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

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.