Skip to content

Instantly share code, notes, and snippets.

@dleone81
Created March 11, 2016 08:48
Show Gist options
  • Save dleone81/40ada3cd1ab467b3347d to your computer and use it in GitHub Desktop.
Save dleone81/40ada3cd1ab467b3347d to your computer and use it in GitHub Desktop.
Avoid Magento
#!/bin/bash
# This file reindex all Magento indexes without any lock table
# This is the right order to reindexall via script
# I update every 3 sec any Magento product via API.
# Before this script I noticed this error
# SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction
echo "Reindexall via script"
php /mage/magento/shell/indexer.php --reindex cataloginventory_stock
php /mage/magento/shell/indexer.php --reindex catalog_product_attribute
php /mage/magento/shell/indexer.php --reindex catalog_product_price
php /mage/magento/shell/indexer.php --reindex catalog_url
php /mage/magento/shell/indexer.php --reindex catalog_product_flat
php /mage/magento/shell/indexer.php --reindex catalog_category_flat
php /mage/magento/shell/indexer.php --reindex catalog_category_product
php /mage/magento/shell/indexer.php --reindex catalogsearch_fulltext
php /mage/magento/shell/indexer.php --reindex tag_summary
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment