简体   繁体   中英

Magento indexer running via ssh but not cron job

I can reindex magento indexes via ssh command line with this code:

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

or individual indexes with this code:

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

And that works fine. However whenever i try to reindex via cron i get this:

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

Any ideas? Thanks

Try adding the path to PHP. Try this:

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

This will depend on your path to PHP though!

you need to provide us the name of indexer

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

indexer_code as mention below. eg //to reindex all indexes

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

Below are the list of indexer code

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

The answer by sulman works, but only if you add it via crontab -e command in ssh. No sure if this is due to permissions. In my case indexer.php had 755

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM