Make WordPress Core

Opened 10 years ago

Closed 9 years ago

#33994 closed enhancement (maybelater)

Multisite cron from command line (eg. crontab)

Reported by: grezvany13's profile Grezvany13 Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Cron API Keywords:
Focuses: multisite Cc:

Description

For a project I'm working on we needed a way to run wp-cron.php for multiple blogs on a network, while using crontab to run the cron at a fixed interval.

However we found the issue that we not only had to call wp-cron.php for every single blog, but also were forced to use either wget or cURL to make sure every blog got called separately.

To fix this issue I've build a replacement for wp-cron.php, currently called wp-cron-multi.php which allows us to have a single cron (in crontab), but checks all transients on all blogs which are active.

It does allow/require some arguments, so it works perfectly in multiple situation (like usage of $_SERVERHTTP_HOST? and custom path to the WP core).

Personally I think this would be a nice addition to the WP core, either to replace the current wp-cron.php file or as an addition to the current method.

A gist with the code can be found at https://gist.github.com/Grezvany13/35384a7855d544c7fed7

Change History (2)

#1 @dd32
9 years ago

I feel this is probably best left to 3rd party tools, such as the tool you've written up, or something such as Cavalcade by Human Made which handles wp cron entries differently.

Once you pass a certain threshold, having to add individual tasks or having the script process all sites on the network just isn't going to scale.

#2 @jeremyfelt
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to maybelater
  • Status changed from new to closed

Agreed. Once things scale to the point where special cron handling is necessary, there are better ways to handle it—with a jobs system—rather than via WordPress core itself. I think we're better off leaving this at the plugin level.

Note: See TracTickets for help on using tickets.