cron-command icon indicating copy to clipboard operation
cron-command copied to clipboard

Add --network flag for event run

Open apermo opened this issue 6 months ago • 0 comments

Feature Request

Describe your use case and the problem you are facing

In a multisite environment when you want to run wp cli cron, you end up with either:

*/5 * * * * /var/www/html/vendor/bin/wp cron event run --due-now --path=/var/www/html/web/wp/ --url=blog.company.tld/de/
*/5 * * * * /var/www/html/vendor/bin/wp cron event run --due-now --path=/var/www/html/web/wp/ --url=blog.company.tld/en/
*/5 * * * * /var/www/html/vendor/bin/wp cron event run --due-now --path=/var/www/html/web/wp/ --url=blog.company.tld/fr/
*/5 * * * * /var/www/html/vendor/bin/wp cron event run --due-now --path=/var/www/html/web/wp/ --url=blog.company.tld/it/
*/5 * * * * /var/www/html/vendor/bin/wp cron event run --due-now --path=/var/www/html/web/wp/ --url=blog.company.tld/nl/
*/5 * * * * /var/www/html/vendor/bin/wp cron event run --due-now --path=/var/www/html/web/wp/ --url=blog.company.tld/es/

A custom bash script or as best solution

wp site list --field=url | xargs -i -n1 wp cron event run --due-now --url="{}" Credits: https://wordpress.stackexchange.com/a/349924

Describe the solution you'd like

While the suggestion from Stackoverflow is perfectly doint the job, this is rather complex and a small overhead.

I would love to just be able to run:

wp cron event run --due-now --network

This would be way cleaner than having n crons in the crontab, and cleaner and less overhead than the stackoverflow suggestion.

apermo avatar Jul 16 '25 07:07 apermo