Shopping cart

Magento 2 How to Run cron job manually via Command Line

In this tutorial, we will talk about How to Run cron job manually via Command Line in Command Line Series. As you know, from Magento 2, they add many commands in bin/magento. This may difficult to get approach this, let me explain more detail about How to Run cron job manually via Command Line.

How to Run cron job manually via Command Line

Go to Magento admin root folder and show usage:

php bin/magento cron:run --help
Usage:
  cron:run [options]

Options:
      --group=GROUP          Run jobs only from specified group
      --bootstrap=BOOTSTRAP  Add or override parameters of the bootstrap
  -h, --help                 Display this help message
  -q, --quiet                Do not output any message
  -V, --version              Display this application version
      --ansi                 Force ANSI output
      --no-ansi              Disable ANSI output
  -n, --no-interaction       Do not ask any interactive question
  -v|vv|vvv, --verbose       Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Help:
  Runs jobs by schedule

Syntax to Run Cron Manually

php bin/magento cron:run [options]

Let run cron job manually command line. Type in the command line in root folder of Magento 2:

php bin/magento cron:run

Output:

Ran jobs by schedule.

You may get this error:


  [Exception]
  Warning: file_put_contents(./var/cache//mage-tags/mage---6b9_TRANSLATE): failed to open stream:
  Permission denied in ./vendor/colinmollenhour/cache-backend-file/File.php on line 663


cron:run [--group GROUP] [--bootstrap BOOTSTRAP]

You should make sure the var folder is writable.

Run Cron job with options

  • --group=GROUP : Run jobs only from specified group
  • --bootstrap=BOOTSTRAP : Add or override parameters of the bootstrap




Enjoyed the tutorial? Spread it to your friends!

magento-2-module-development
command
line
cli
console

Comments for Magento 2 How to Run cron job manually via Command Line

Please leave comments if you have any questions, feedbacks.

Module Development

We recommend:

You also may like these Magento 2 Extensions

One Step Checkout

$199
69 reviews

SEO Ultimate

$299
no review