Cron作业设置在多个magento实例上

时间:2011-02-14 18:01:40

标签: magento cron amazon-ec2 instances

是否有人在应用程序的多个实例中有Magento模块级cron作业的经验?

我知道Magento将cron记录添加到cron_schedule表中 - Magento应用程序的每个实例都会将它自己的调用添加到模块级cron中吗?

所有应用程序实例都在查看同一个数据库。

感谢您的任何见解。

1 个答案:

答案 0 :(得分:3)

如果您有多个Magento副本和一个公共数据库,那么您可以进行多站点安装。只为一台服务器添加一个cron作业,不需要任何其他服务器的cron。

Magento不会为您调用cron,您仍然需要编辑服务器的crontab。来自the Magento Wiki

  

要执行所有这些已配置的任务,需要定期运行位于Magento根目录中的cron.php文件,例如每15分钟运行一次。基本上,此脚本将检查是否需要运行任何任务,以及是否需要安排任何将来的任务。

     

在UNIX / BSD / linux系统中,您需要将此行(或类似的行)添加到您的crontab:

 # for debugging purposes only:
 MAILTO=your.user@your.server.com

 */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