Magento Auto Reindexing Using Cron.

Hello Everyone Below Script Is Used To Automatically Reindexing In Magento. This Script Is’nt Reindexing all the Index every time. But, It’ll Reindexing Only Index Type Which Is Required To Reindexing In Magento.

In Below Code I Have Create The Log File Using Following Line “Mage::log(‘Index ‘.$indexer->getIndexerCode().” Is Reindex.”,null,’Index_AutoRefresh.log’);”. So You Can Check The Indixing Log on “Index_AutoRefresh.log” File Which Locate In “var/log/Index_AutoRefresh.log”.


//Cache Refresh Start

ini_set('max_execution_time', 18000); 

require_once 'app/Mage.php';

$app = Mage::app('admin');



//Indexing Start



foreach($indexerCollection as $indexer)



Mage::log('Index '.$indexer->getIndexerCode()." Is Reindex.",null,'Index_AutoRefresh.log'); 


//Indexing End


For Automatically Reindexing You Just Need To Create One File On Magento Root Folder For Example AutocronReindex.php And Add This File On Cron.

Thanks for reading my blog. I hope it will help you, Please leave your comments here if it’s really help you. 🙂

Thank You :),
Mayank Zalavadia