Magento 2 How to Run cron job manually via Command Line

Magento has a way to make all of your future plans! First, let’s talk about the cron job. This type of task is used by many Magento features. A partial list of these are: catalog price rules, generating Google sitemaps, customer alerts/notifications for changes in product prices, product stock, reindexing, and private sales. If you use Adobe Commerce, it works for private sales. Magento also has something called automatic currency rate updates and all confirmation emails and emails for transactions too.

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 be difficult to approach, so let me explain in more detail about How to Run cron job manually via Command Line.

Find out How to Create Cron Jobs programmatically

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

All done! Using the Command Line to run cron jobs manually is not difficult at all, right? I hope you could do it right away after one try, but if not, don’t worry, contact us here or comment below for further support.

Explore Mageplaza Cron Schedule extension

Enjoyed the tutorial? Spread it to your friends!

magento-2-module-development
command
line
cli
console

Sam Thomas
Sam Thomas

CEO and Founder of Mageplaza. Pursueing a simple and healthy lifestyle. A friend, a husband and a dad of two children, a trainer and an influencer wannabe. He is a big fan of sports and travel, also.

People also searched for

  • magento 2 run cron job manually
  • magento 2 run specific cron job manually
  • magento run cron job manually
  • magento2 run cron job manually
  • magento 2 cron run command
  • magento 2 run cron manually
  • run cron manually magento 2
  • run cron magento 2
  • run cron job magento 2 command
  • magento 2 run cron
  • magento 2 manually run cron
  • cron run magento 2
  • magento 2 run cron command line
  • how to run cron job manually in magento 2
  • php bin/magento cron:run
  • magento 2 cron run manually
  • cron run command in magento 2
  • magento 2 run cron from command line
  • run cron job magento 2
  • magento 2 cron run
  • magento cron run
  • how to run cron job manually
  • magento cron:run
  • magento 2 debug cron job
  • magento 2 run cron job
  • 2.2.x, 2.3.x, 2.4.x