Warning: Cannot modify header information - headers already sent by (output started at /www/wwwroot/sbboke.com/wp-content/plugins/wordpress-seo/src/integrations/front-end-integration.php:409) in /www/wwwroot/sbboke.com/wp-content/themes/pacify/content-single.php on line 5

Magento 2如何通过命令行手动运行cron作业

在本教程中,我们将讨论手动如何运行cron作业通过命令行中的命令行系列。如您所知,在Magento 2中,它们在中添加了许多命令bin/magento。这可能很难解决,让我解释一下如何通过命令行手动运行cron作业的更多细节。

如何通过命令行手动运行cron作业

转到Magento管理员根文件夹并显示用法:

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

手动运行Cron的语法

php bin/magento cron:run [options]

让我们手动运行cron job命令行。在Magento 2的根文件夹中输入命令行:

php bin/magento cron:run

输出:

Ran jobs by schedule.

您可能会收到此错误:


  [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]

您应该确保该var文件夹可写。

使用选项运行Cron作业

  • --group=GROUP :仅运行指定组中的作业
  • --bootstrap=BOOTSTRAP :添加或覆盖引导程序的参数

相关文章

0 0 投票数
文章评分
订阅评论
提醒
0 评论
内联反馈
查看所有评论