Cleaning the log tables and rebuilding indexes with shell scripts


magento shells scripts usage

Based on the same idea as my “cache clearing script“ (but 10x better), Magento now includes some handy scripts to clean the log tables, to compile source files and to rebuild indexes. For people with very large databases (10k+ products) this is sometimes the only way to actually accomplish something without running out of memory or exceeding execution time limits. The scripts are located in the /shell folder. These scripts are made to be run manually by logging on the server with SSH or they may also be setup to be executed periodically as a cron job.

Below, is a little preview of the possible operations

Usage: php -f log.php -- [options]
php -f log.php -- clean --days 1
clean                Clean Logs
--days <days>  Save log, days. (Minimum 1 day, if defined - ignoring system value)
status               Display statistics per log tables
help                 This help
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
Usage:  php -f compiler.php -- [options]
state         Show Compilation State
compile       Run Compilation Process
clear         Disable Compiler include path and Remove compiled files
enable        Enable Compiler include path
disable       Disable Compiler include path
help          This help

One response to “Cleaning the log tables and rebuilding indexes with shell scripts”

  1. Thanks I was finally able to clean my cache, having 30k+ products means its impossible to use the backend to refresh the cache without timeout.