1

cron_groups.xml

<?xml version="1.0"?>
<group id="custom_crongroup">
    <schedule_generate_every>5</schedule_generate_every>
    <schedule_ahead_for>10</schedule_ahead_for>
    <schedule_lifetime>15</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>

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="custom_crongroup">
        <job name="monthly_commission" instance="Rewamp\Promotion\Cron\Run" method="execute">
            <schedule>*/5 * * * *</schedule>
        </job>
    </group>

This cusotm cron is working correctly when i run the cron,

php bin/magento cron:run

from terminal. But i need to run the cron automatically in every 5 minutes. how can i implement this?.

0

If it's successfully working from terminal, then you need to set up the actual server cron job to run the command.

Have the cron command run every 1 minute. You're custom cron job however will still only run every 5 minutes because Magento knows when it should be ran.

Below is documentation from the Magento themselves instructing how to do so:

http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-cron.html

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.