Magento 2 : How to run 2 cron jobs at the same time?
-
19-03-2021 - |
Question
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>
Solution
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>
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange