3

Below given is crontab.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
<group id="customemarsys_cron">
    <!-- catalog Related Jobs -->
    <job name="custom_product_sync" instance="Custom\Module\Cron\ProductSync" method="execute">
        <schedule>* */1 * * *</schedule>
    </job>
</group>

cron_groups.xml

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/cron_groups.xsd">
<group id="customemarsys_cron">
    <schedule_generate_every>15</schedule_generate_every>
    <schedule_ahead_for>20</schedule_ahead_for>
    <schedule_lifetime>15</schedule_lifetime>
    <history_cleanup_every>10</history_cleanup_every>
    <history_success_lifetime>10080</history_success_lifetime>
    <history_failure_lifetime>10080</history_failure_lifetime>
    <use_separate_process>0</use_separate_process>
</group></config>

I tried to run php -dmemory_limit=6G bin/magento cron:run --group customemarsys_cron

But it reflects error

main.WARNING: Could not acquire lock for cron group: customemarsys_cron, skipping run [] []

  • <use_separate_process>1</use_separate_process> could you please do this change and cache:clean and try? – Keyur Shah Apr 19 at 10:08
  • find any solution ??? – Rk Rathod Jul 16 at 7:46
0

As far as I know there are 2 cron groups by default in Magento 2: default and index.
Try to change your cron group to default and check again:

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
<group id="default">
    <!-- catalog Related Jobs -->
    <job name="custom_product_sync" instance="Custom\Module\Cron\ProductSync" method="execute">
        <schedule>* */1 * * *</schedule>
    </job>
</group>
  • i want for my custom cron group – Parthavi Apr 19 at 7:05
  • @Parthavi how did you define your crongroup, can you include it in your post – fmsthird Apr 19 at 7:23
  • yes i have included in my post please check it – Parthavi Apr 19 at 8:49
  • I see nothing is wrong , try changing schedule <schedule>* * * * *</schedule> – fmsthird Apr 19 at 8:56
  • Do any permission require to acquire lock for cron group? Because the same code is working in test server and not in live server – Parthavi Apr 19 at 9:03
0

Try to execute following sql query in phpmyadmin and then execute your cron.

SELECT RELEASE_ALL_LOCKS();

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.