I want to set an cronjob for reindexing some indexes, but preferably not all.

  • First of all, how would I set one up for all?
  • And if possible how to I exclude a specific index?

4 Answers 4


To reindex all indexes:
php -f indexer.php reindexall

To retrieve a full list of available indexes:
php -f indexer.php info

Then specify the type of index you would like to reindex like so:
php indexer.php --reindex catalog_product_attribute

Below is the full list of individual commands:
php indexer.php --reindex catalog_product_price
php indexer.php --reindex catalog_url
php indexer.php --reindex catalog_product_flat
php indexer.php --reindex catalog_category_flat
php indexer.php --reindex catalog_category_product
php indexer.php --reindex catalogsearch_fulltext
php indexer.php --reindex cataloginventory_stock
php indexer.php --reindex tag_summary

To retrieve a full list of indexer commands:
php -f indexer.php help


You can set below code in one .sh file for specific index and set this sh file in to your cron tab

echo "catalog_product_attribute"
php /YOurMagentoDir/shell/indexer.php --reindex catalog_product_attribute

hope this will work for you.


You can follow this thread for the reindexing issue,


You can set the file you create for cron. Set cron with defined interval from the cpanel.


For all indexs:

$processes = $indexer->getProcessesCollection();
foreach ($processes as $process) {

You can ask if it need to be reindexed by :

if ($process->getStatus == Mage_Index_Model_Process::STATUS_REQUIRE_REINDEX)

For some indexs:

    $index_codes = array('catalog_product_attribute', 'catalog_product_price', 'cataloginventory_stock');
    foreach($index_codes as $code){
       $process = Mage::getSingleton('index/indexer')->getProcessByCode($code);
       $process -> reindexEverything();

Good Luck!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.