简体   繁体   English

Magento Cron Tab工作时区

[英]Magento Cron Tab Job Time zone

Im trying to figure out if my module cron is running at the correct time. 我想弄清楚我的模块cron是否在正确的时间运行。

The cron for my module is set at 1am (0 1 * * *), the time zone of the default store is Western Europe (Paris, Berlin etc GMT +2), the server time is EDT (Eastern Daylight Time). 我模块的cron设置为凌晨1点(0 1 * * *),默认商店的时区是西欧(巴黎,柏林等GMT +2),服务器时间是EDT(东部夏令时)。

So on which time zone is the 1am schedule based on? 那么在哪个时区是基于的1am时间表?

Thanks, 谢谢,

The Magento cron process runs under the UTC timezone. Magento cron进程在UTC时区下运行。

This can be verified by temporarily adding a small log statement to the cron observer. 这可以通过临时向cron观察者添加一个小的日志语句来验证。

The method is: 方法是:

Mage_Cron_Model_Observer::dispatch()

Look for this code in the first few lines: 在前几行中查找此代码:

$now = time();

Either right before or after, add this: 无论是在之前还是之后,添加:

Mage::log("cron timezone: " . date_default_timezone_get(), Zend_Log::DEBUG);

Then check your var/log/system.log file and you will see that PHP/Magento is using the UTC timezone. 然后检查var / log / system.log文件,您将看到PHP / Magento正在使用UTC时区。

The Magento cron job log times are recorded in UTC. Magento cron作业日志时间以UTC格式记录。 Actual run times are based off the TZ offset (server time). 实际运行时间基于TZ偏移量(服务器时间)。 Here's a Cron Job Monitor script that shows you the jobs as they're scheduled and then their completion times. 这是一个Cron作业监视器脚本,可以显示已安排的作业以及完成时间。 It also gives you UTC, the server time and your store time (single store). 它还为您提供UTC,服务器时间和您的商店时间(单店)。 All three can be different. 这三者可以是不同的。 Cron Job Monitor Cron Job Monitor

For it to be useful, I set System Config to keep errors and logged information for 24 hours. 为了使它有用,我设置系统配置以保持错误和记录信息24小时。 That way you can actually monitor the big jobs that run in the early AM and confirm they're really running. 这样你就可以实际监控上午早些时候运行的大型工作,并确认它们真的在运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM