Magento索引器通过ssh运行但不是cron作业

时间:2014-09-16 07:51:32

标签: php magento ssh cron indexer

我可以使用以下代码通过ssh命令行重新索引magento索引:

php -f [path to store]/shell/indexer.php reindex 

或使用此代码的单个索引:

php -f [path to store]/shell/indexer.php -- reindex [index]

这很好用。然而,无论何时我尝试通过cron重新索引,我都会得到:

Usage:  php -f indexer.php -- [options]

--status <indexer>            Show Indexer(s) Status
--mode <indexer>              Show Indexer(s) Index Mode
--mode-realtime <indexer>     Set index mode type "Update on Save"
--mode-manual <indexer>       Set index mode type "Manual Update"
--reindex <indexer>           Reindex Data
info                          Show allowed indexers
reindexall                    Reindex Data by all indexers
help                          This help

<indexer>     Comma separated indexer codes or value "all" for all indexers

有什么想法吗? 感谢

3 个答案:

答案 0 :(得分:2)

尝试添加PHP的路径。试试这个:

/usr/local/bin/php -q [path to store]/shell/indexer.php --reindex catalogsearch_fulltext

这取决于你的PHP路径!

答案 1 :(得分:0)

您需要向我们提供索引器的名称

 php -f [path to store]/shell/indexer.php reindex **indexer_code**

indexer_code 如下所述。 例如 //重新索引所有索引

php -f [path to store]/shell/indexer.php reindex all 

以下是索引器代码列表

catalog_product_attribute     Product Attributes
catalog_product_price         Product Prices
catalog_url                   Catalog URL Rewrites
catalog_product_flat          Product Flat Data
catalog_category_flat         Category Flat Data
catalog_category_product      Category Products
catalogsearch_fulltext        Catalog Search Index
cataloginventory_stock        Stock Status
tag_summary                   Tag Aggregation Data

答案 2 :(得分:0)

苏曼的答案有效,但前提是你在ssh中通过crontab -e命令添加它。不确定这是否是由于权限。在我的情况下,indexer.php有755

相关问题