Cron Job 问题 Magento

Cron Job issue Magento

我面临的问题是我的 magento 商店无法使用订单电子邮件。我安装了 AOE 调度程序,但我遇到了这个问题

未找到心跳任务。检查cron是否配置正确

虽然我已经在cpanel上设置了

和 magento 上的 AOE 调度程序设置

我每秒都会收到这封邮件

Available actions: 
    --action listAllCodes
    --action lastRun --code <code> [--secondsFromNow]   Get the timestamp of the last successful run of a job for a given code
    --action scheduleNow --code <code>  Schedule a job to be executed as soon as possible
    --action runNow --code <code> [--tryLock] [--force]         Run a job directly
    --action wait [--timout <timeout=60>]               Active wait until no schedules are running.
    --action flushSchedules --mode (future|all)         Flush schedules.
    --action listAllRunningSchedules
    --action killAll
    --action watchdog
    --action cron --mode (always|default) [--includeJobs <comma separated list of jobs>] [--excludeJobs <comma separated list of jobs>] [--includeGroups <comma separated list of groups>] [--excludeGroups <comma separated list of groups>]

我卡住了我不知道如何解决这个问题,请帮忙

这是 Magento 2 文档中隐藏的内容。使用 composer 安装 Magento 2 后,您还没有完成安装。需要再次进入 /update/ 文件夹和 运行 composer update 以便它安装一些需要的包以便 cron 正常工作。

我见过很多 Magento2 设置都没有完成这个额外的步骤,因此除了 cron 之外一切正常。

如果你使用命令行,它应该是这样的:

[html]$ cd update/
[update]$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 29 installs, 0 updates, 0 removals
  - Installing psr/log (1.0.2): Loading from cache
  - Installing monolog/monolog (1.16.0): Loading from cache
  - Installing symfony/yaml (v2.8.25): Loading from cache
  - Installing sebastian/version (1.0.6): Loading from cache
  - Installing sebastian/recursion-context (1.0.5): Loading from cache
  - Installing sebastian/exporter (1.2.2): Loading from cache
  - Installing sebastian/environment (1.3.8): Loading from cache
  - Installing sebastian/diff (1.4.3): Loading from cache
  - Installing sebastian/comparator (1.2.4): Loading from cache
  - Installing doctrine/instantiator (1.0.5): Loading from cache
  - Installing phpunit/php-text-template (1.2.1): Loading from cache
  - Installing phpunit/phpunit-mock-objects (2.3.8): Loading from cache
  - Installing phpunit/php-timer (1.0.9): Loading from cache
  - Installing phpunit/php-file-iterator (1.3.4): Loading from cache
  - Installing phpunit/php-token-stream (1.4.11): Loading from cache
  - Installing phpunit/php-code-coverage (2.2.4): Loading from cache
  - Installing phpunit/phpunit (4.1.0): Loading from cache
  - Installing symfony/console (v2.6.13): Loading from cache
  - Installing symfony/process (v3.3.5): Loading from cache
  - Installing symfony/finder (v3.3.5): Loading from cache
  - Installing symfony/filesystem (v3.3.5): Loading from cache
  - Installing seld/phar-utils (1.0.1): Loading from cache
  - Installing seld/jsonlint (1.6.1): Loading from cache
  - Installing seld/cli-prompt (1.0.3): Loading from cache
  - Installing justinrainbow/json-schema (1.6.1): Loading from cache
  - Installing composer/spdx-licenses (1.1.6): Loading from cache
  - Installing composer/semver (1.4.2): Loading from cache
  - Installing composer/composer (1.0.0-beta1): Loading from cache
  - Installing magento/composer (1.0.3): Loading from cache
monolog/monolog suggests installing aws/aws-sdk-php (Allow sending log messages to AWS services like DynamoDB)
monolog/monolog suggests installing doctrine/couchdb (Allow sending log messages to a CouchDB server)
monolog/monolog suggests installing ext-mongo (Allow sending log messages to a MongoDB server)
monolog/monolog suggests installing graylog2/gelf-php (Allow sending log messages to a GrayLog2 server)
monolog/monolog suggests installing php-console/php-console (Allow sending log messages to Google Chrome)
monolog/monolog suggests installing raven/raven (Allow sending log messages to a Sentry server)
monolog/monolog suggests installing rollbar/rollbar (Allow sending log messages to Rollbar)
monolog/monolog suggests installing ruflin/elastica (Allow sending log messages to an Elastic Search server)
monolog/monolog suggests installing videlalvaro/php-amqplib (Allow sending log messages to an AMQP server using php-amqplib)
phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)
symfony/console suggests installing symfony/event-dispatcher ()
Writing lock file
Generating autoload files
[update]$ 

https://magento.stackexchange.com/questions/186044/cron-jobs-for-order-emails?noredirect=1#comment257244_186044

看起来 PATH 变量在 jailshelled cron 环境中的设置有些不同。所以我想使用了不同的 php 二进制文件。您可以通过 SSH 连接到您的 cPanel 帐户并在您的 crontab 中设置 PATH。

所以 crontab 应该像这样开始:

SHELL=/bin/sh
PATH=/usr/local/jdk/bin:/usr/local/bin:/usr/bin:/opt/cpanel/composer/bin:/usr/local/bin:/usr/X11R6/bin:/home/username/.local/bin:/home/username/bin