0

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>
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>
  • I tried your solution and it worked. But I was still wondering why my code wasn't working. So I tried my code again and it worked! I am so confused! Why does it work only sometimes? – R.P. Nov 12 at 16:21
  • Not sure sorry. Should have worked first time. – Dominic Xigen Nov 12 at 20:47

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.