0

I have created cron for my custom module using this link http://devdocs.magento.com/guides/v2.0/config-guide/cron/custom-cron-ref.html

crontab.xml

<?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="test">
        <job name="test" instance="test\Ship\Cron\Observer" method="cronOderSync">
            <schedule>*/5 * * * *</schedule>
        </job>
    </group>
</config>

And cron_groups.xml

<?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="test">
        <schedule_generate_every>5</schedule_generate_every>
        <schedule_ahead_for>4</schedule_ahead_for>
        <schedule_lifetime>4</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>

So I have two issues:

1) when I run bin/magento cron:run [--group="<cron group name>"], it run all crons file.

2) I have setup schedule in cron_group.xml file, but it did not run cron every 5 minutes automatically. 
0

Run below code and check:

bin/magento cron:run [--group="test"]
  • I run this command but run all cron. – Priya Apr 21 '18 at 7:01
  • @Priya change group id from " <group id="test">" to " <group id="default">" and test please – Chirag Rajput Apr 21 '18 at 7:23

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.