有人有跨应用程序多个实例的 Magento 模块级 cron 作业的经验吗?
我知道 Magento 将 cron 记录添加到 cron_schedule 表中 - Magento 应用程序的每个实例都会将其自己的调用添加到模块级 cron 中吗?
所有应用程序实例都查看同一个数据库。
感谢您提供任何见解。
最佳答案
如果您有多个带有公共(public)数据库的 Magento 副本,那么您就拥有了多站点安装。仅为一台服务器添加 cron 作业,无需为其他服务器添加 cron 作业。
Magento 不会为您调用 cron,您仍然需要编辑服务器的 crontab。来自 the Magento Wiki :
To execute all these configured tasks, the cron.php file located in the Magento root will need to be run periodically, for example every 15 minutes. Basically, this script will check if it needs to run any tasks, and if it needs to schedule any future tasks.
In UNIX/BSD/linux systems you will need to add this line (or a similar line) to your crontab:
# for debugging purposes only: <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1b565a52574f542662746e69356e687e695b62746e6935687e696d7e6935787476" rel="noreferrer noopener nofollow">[email protected]</a> */5 * * * * /bin/sh /absolute/path/to/magento/cron.sh # /absolute/path/to/bin/php - replace with path to your PHP5 CLI executable # example: /usr/local/php5/bin/php-cli # in order to find what is the PHP CLI executable you can try to the following command in shell: # which php # /absolute/path/to/magento/cron.php - replace with path to Magento installation # example: /home/user/public_html/magento/cron.php
关于magento - 在 magento 的多个实例上设置 Cron 作业,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4995581/