Magento 2 Cron Script Execute From CLI
-
05-03-2021 - |
Question
How can I execute my cron class in command line especially for testing.
normally one could php -f myfile.php
OR
Calling a method's class:
php -r 'include "/path/to/file.php"; ClassName::MethodName();'
I have a Cron class and would like to test in command line to display E.G: 'Hello World!?
No correct solution
OTHER TIPS
Run cron from the command line Command options:
$ bin/magento cron:run [--group="<cron group name>"]
Like $ php bin/magento cron:run --group="customgroupname_cron"
where --group specifies the cron group to run (omit this option to run cron for all groups)
To run the indexing cron job, enter:
bin/magento cron:run --group index
To run the default cron job, enter:
bin/magento cron:run --group default
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange