0

I have set my cronjob code and i am running command

php bin/magento setup:cron:run --group="customgroupname_cron"

but getting below error

[Symfony\Component\Console\Exception\RuntimeException]

The "--group" option does not exist.

Can anyone help please?

  • It means cron isn't setup in your server you need to setup cron in server – Rv Singh Jul 24 '18 at 13:04
  • Can we set it on localhost? – Rutvee Sojitra Jul 24 '18 at 13:10
  • Yes, you can do it – Rv Singh Jul 24 '18 at 13:14
  • Can you please help me .how to set it? – Rutvee Sojitra Jul 24 '18 at 13:16
1

Magento 2, there are three cron jobs required. Because windows doesn’t have cron, we have to use a bat file and configure it to run as a scheduled task as shown below:

Find the location of php.exe – In you have Wamp installed, it’s in Drive:\wamp\bin\php\php5.6.25 e.g c:\wamp\bin\php\php5.6.25

Go to a folder and create a file named yourcron.bat

Edit this file and paste 3 lines shown below:

in the following file I have added to cron job for re-indexing and cache

C:\wamp\bin\php\php5.6.25\php.exe C:\wamp\www\magento2\bin\magento cron:run
C:\wamp\bin\php\php5.6.25\php.exe C:\wamp\www\magento2\update\cron.php
C:\wamp\bin\php\php5.6.25\php.exe C:\wamp\www\magento2\bin\magento setup:cron:run
C:\wamp\bin\php\php5.6.25\php.exe C:\wamp\www\magento2\bin/magento indexer:reindex
C:\wamp\bin\php\php5.6.25\php.exe C:\wamp\www\magento2\bin/magento cache:flush
Save the file, open command prompt and enter following command:

schtasks /create /sc minute /mo 5 /tn Magento\Cron /tr

C:\wamp\bin\php\php5.6.25\yourcron.bat

Now click on Start –> Control Panel –> Administrative Tools –> Task Scheduler

Expand Task Schedule Library from the left hand column and click Magento.

Select Cron from the middle pane, click properties from the right pane under selected items.

Under Security Options, click the Change User or Group button.

Now in the current window, enter System username in the object name box and click check names. Click OK to close the User window, and OK to close the Cron properties Window, and close Task Scheduler.

Cron job setup is successful and it will run every 5 minutes.

Hope this will help you.

0

Current configuration(Run in every 5mins):

  1. open your CMD and type crontab -e command.

  2. add below code

Cron on server: */5 * * * * /usr/bin/php /var/www/html/magento2

/bin/magento cron:run --group="customapi"

Set you group

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.