【发布时间】:2023-01-29 23:00:39
【问题描述】:
我正在尝试为 Reindex 实现一个 shell 脚本。
关心:
我在一台服务器上有五个站点。 (html-abc、html-cdf、html-xyz 等,位于 /var/www/)。我想使用 shell 脚本为每个站点运行重新索引,并且应该在 reindex.log 文件中记录带有时间戳的日志。
目前我正在使用 cron 为每个站点执行重建索引,但我无法在日志文件中看到时间戳。任何人都可以帮忙吗?
样本计划 */30 * * * * /usr/bin/php7.4 /var/www/html-abc/bin/magento indexer:reindex 2>&1 | grep -v “按计划运行作业” >> /var/log/magento_index.log
我得到的结果
test@testaz:~/scripts$ tail -n 50 /var/log/magento_index.log Design Config Grid index has been rebuilt successfully in 00:00:00 Customer Grid index has been rebuilt successfully in 00:00:00 process error during indexation process: Product Flat Data index is locked by another reindex process. Skipping. Category Products index has been rebuilt successfully in 00:00:01 Product Categories index has been rebuilt successfully in 00:00:00 Catalog Rule Product index has been rebuilt successfully in 00:00:00 Product EAV index has been rebuilt successfully in 00:00:02 Stock index has been rebuilt successfully in 00:00:01 Inventory index has been rebuilt successfully in 00:00:00 Catalog Product Rule index has been rebuilt successfully in 00:00:00 Product Price index has been rebuilt successfully in 00:00:09 Catalog Search index has been rebuilt successfully in 00:00:03 Design Config Grid index has been rebuilt successfully in 00:00:00 Customer Grid index has been rebuilt successfully in 00:00:01 process error during indexation process: Product Flat Data index is locked by another reindex process. Skipping. Category Products index has been rebuilt successfully in 00:00:01 Product Categories index has been rebuilt successfully in 00:00:00 Catalog Rule Product index has been rebuilt successfully in 00:00:00 Product EAV index has been rebuilt successfully in 00:00:01 Stock index has been rebuilt successfully in 00:00:00 Inventory index has been rebuilt successfully in 00:00:00 Catalog Product Rule index has been rebuilt successfully in 00:00:00 Product Price index has been rebuilt successfully in 00:00:02 Catalog Search index has been rebuilt successfully in 00:00:02
样本计划 */30 * * * * /usr/bin/php7.4 /var/www/html-abc/bin/magento indexer:reindex 2>&1 | grep -v “按计划运行作业” >> /var/log/magento_index.log
我得到的结果
test@testaz:~/scripts$ tail -n 50 /var/log/magento_index.log Design Config Grid index has been rebuilt successfully in 00:00:00 Customer Grid index has been rebuilt successfully in 00:00:00 process error during indexation process: Product Flat Data index is locked by another reindex process. Skipping. Category Products index has been rebuilt successfully in 00:00:01 Product Categories index has been rebuilt successfully in 00:00:00 Catalog Rule Product index has been rebuilt successfully in 00:00:00 Product EAV index has been rebuilt successfully in 00:00:02 Stock index has been rebuilt successfully in 00:00:01 Inventory index has been rebuilt successfully in 00:00:00 Catalog Product Rule index has been rebuilt successfully in 00:00:00 Product Price index has been rebuilt successfully in 00:00:09 Catalog Search index has been rebuilt successfully in 00:00:03 Design Config Grid index has been rebuilt successfully in 00:00:00 Customer Grid index has been rebuilt successfully in 00:00:01 process error during indexation process: Product Flat Data index is locked by another reindex process. Skipping. Category Products index has been rebuilt successfully in 00:00:01 Product Categories index has been rebuilt successfully in 00:00:00 Catalog Rule Product index has been rebuilt successfully in 00:00:00 Product EAV index has been rebuilt successfully in 00:00:01 Stock index has been rebuilt successfully in 00:00:00 Inventory index has been rebuilt successfully in 00:00:00 Catalog Product Rule index has been rebuilt successfully in 00:00:00 Product Price index has been rebuilt successfully in 00:00:02 Catalog Search index has been rebuilt successfully in 00:00:02
【问题讨论】:
标签: magento cron devops reindex