<?xml version="1.0"?>
<group id="custom_crongroup">


<?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>

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?.

4 Answers 4


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:



Maybe this is your idea.

  1. Check cronjob installed in your environment

crontab -i

You can install cronjob in ubuntu with command

sudo apt install cron

  1. Install magento cronjob

Go to magento workspace and run command line:

php bin/magento cron:remove

php bin/magento cron:install

  1. Check Magento cron is installed in the environment

crontab -l

  1. Open Mysql and check cron is worked
SELECT * FROM `cron_schedule`
1. Open terminal 
2. write a command crontab -e 
3. write below command

* * * * * /usr/bin/php /var/www/html/magento2/bin/magento cron:run 2>&1 | grep -v "Ran jobs by schedule" >> /var/www/html/magento2/var/log/magento.cron.log
* * * * * /usr/bin/php /var/www/html/magento2/update/cron.php >> /var/www/html/magento2/var/log/update.cron.log
* * * * * /usr/bin/php /var/www/html/magento2/bin/magento setup:cron:run >> /var/www/html/magento2/var/log/setup.cron.log

Note :- check your php and magento 2 folder path according to your project.

<job instance="Vendor\Module\Cron\Filename" method="execute" name="file_functionality">
  <schedule>*/5 * * * *</schedule>

You can use this to setup cron in every 5 min.

  • Cron works automatically, you don't need to run that command each time. If you are using localhost then it will not work and if you are using any server then this is issue of server for crons. Apr 25, 2022 at 11:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.