Created
November 16, 2019 00:04
-
-
Save tott/9da019907dc123e3fc7378af39677a63 to your computer and use it in GitHub Desktop.
Execute WP-Cron on multisite through wp-cli
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function run_cron_due_now { | |
for SITE_URL in $(wp --allow-root site list --fields=url --format=csv | tail -n +2 | sort); do | |
wp --allow-root cron event run --due-now --url="$SITE_URL" && echo -e "\t+ Completed Crons for $SITE_URL" & | |
done | |
wait $(jobs -p) | |
echo "Done" | |
} | |
run_cron_due_now |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment