drupal cron的最大执行时间

发布于 2024-10-02 01:21:25 字数 40 浏览 0 评论 0原文

cron 的最大执行时间是多少?是否可以修改它,如果有任何副作用。

Whats the maximum execution time of cron. is it possible to modify it if so any side effects.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

娇柔作态 2024-10-09 01:21:25

上面接受的答案是不正确的。 Drupal 中 Cron 的时间限制被硬编码为 240 秒。请参阅 includes/common.inc 中的 drupal_cron_run 函数,特别是以下几行:

drupal_set_time_limit(240);

if (!lock_acquire('cron', 240.0)) {

(基于 Drupal 7.12 的源代码)

因此,如果不这样做,就无法全局更改此设置黑客核心。我听说有人建议您在 hook_cron 实现中自己调用 drupal_set_time_limit ,因为这样做会重置 PHP 的计数器。但是,当它是实现 hook_cron 的第三方模块时,这对您没有帮助。

The accepted answer above is INCORRECT. Cron's time limit in Drupal is hardcoded to 240 seconds. See the drupal_cron_run function in includes/common.inc, specifically these lines:

drupal_set_time_limit(240);

and

if (!lock_acquire('cron', 240.0)) {

(based on the source of Drupal 7.12)

So, there is no way to change this globally without hacking core. I have heard it suggested to call drupal_set_time_limit yourself inside of your hook_cron implementation, as doing so resets PHP's counter. However that won't help you when it's a third-party module implementing hook_cron.

仅此而已 2024-10-09 01:21:25

Drupal 的 cron 的最大执行时间取决于您的 php.ini

例如,如果您使用 wget -O - -q -t 1 http://www.example. com/cron.php 作为你的cron命令,apache的php.ini用于确定最大执行时间。

如果您使用 php -f cron.php 作为 cron 命令,则 php-cli 的 php.ini 用于确定最大执行时间。

建议使用 php-cli 以获得更高的执行时间,您可以从 /etc/php5/cli/php.ini 设置最大执行时间(如果您使用 debian linux)并且没有边cron 运行时对 apache 的影响。

Maximum execution time for Drupal's cron depends on your php.ini.

For example if you use wget -O - -q -t 1 http://www.example.com/cron.php as your cron command, apache's php.ini is used to determine the maximum execution time.

If you use php -f cron.php as your cron command, then php-cli's php.ini is used to determine the maximum execution time.

It is recommended to use php-cli for higher execution time, where you can set the maximum execution time from /etc/php5/cli/php.ini (if you use debian linux) and have no side effects on apache while cron runs.

茶花眉 2024-10-09 01:21:25

我不知道情况是否一定如此,因为我刚刚通过浏览器运行了 cron.php,并且收到了 240 的最大执行时间错误秒,而我的 php.ini 中的最大执行时间是 1200 秒。因此,除了我的 php.ini 文件之外,Drupal 正在获取最大执行时间。

该位置位于 ./includes/common.inc./includes/locale.inc 中。进入那里,有一些设置可以调整 drupal 在放弃之前允许 cron 运行多长时间

I don't know if this is necessarily the case as I've just run the cron.php through my browser and I'm getting a max excution time error of 240 seconds while my max execution time in my php.ini is 1200 seconds. So somewhere besides my php.ini file Drupal is grabbing the max execution time.

That somewhere would be in the ./includes/common.inc or ./includes/locale.inc. Head into there and there are settings to adjust how long drupal will allow the cron to run for before giving up

智商已欠费 2024-10-09 01:21:25

此模块可以帮助您:设置 Cron 时间

This module can help you: Set Cron Time

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文