Magento 2 : How to run 2 cron jobs at the same time?

All we need is an easy explanation of the problem, so here it is.

In my crontab.xml I have 2 different cron jobs which are invoking 2 different methods scheduled to run on the minute. When I do the command “bin/magento cron:run” only one job is running. Below is my crontab.xml file
How do I get both jobs running at the same time?

<?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="jAssign_cronjob" instance="Mobileplans\Cron\Jivetel" method="assignForwarding">
        <schedule>* * * * *</schedule>
    </job>
    <job name="jRemove_cronjob" instance="Mobileplans\Cron\Jivetel" method="removeForwarding">
        <schedule>* * * * *</schedule>
    </job>
</group>
</config>

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

That should work.

Although have you tried a different group?

<config>
    <group id="default">
        <job name="<job_1_name>" instance="<classpath>" method="<method_name>">
            <schedule>* * * * *</schedule>
        </job>
    </group>
    <group id="index">
        <job name="<job_2_name>" instance="<classpath>" method="<method_name>">
            <schedule>* * * * *</schedule>
        </job>
    </group>
</config>

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply