Created
June 14, 2011 19:02
-
-
Save fcingolani/1025598 to your computer and use it in GitHub Desktop.
Bash Script to execute wp-cron.php on a Multisite Wordpress.
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/sh | |
db_host="host"; | |
db_user="user"; | |
db_pass="password"; | |
db_name="database"; | |
domains=`mysql --silent --skip-column-names --host $db_host --user $db_user -p$db_pass $db_name --execute "SELECT domain FROM wp_blogs WHERE archived = '0' AND spam = '0' AND deleted = '0';"`; | |
for domain in $domains; do | |
the_date=`date`; | |
echo -ne "$the_date\t$domain\t"; | |
response=`GET http://$domain/wp-cron.php`; | |
exit_status=$?; | |
if [ $exit_status != 0 ]; then | |
echo "ERR" | |
else | |
echo "OK" | |
fi | |
done; |
I'm going to test it on a 200+ WP
I'll adapt the script if I experience some troubles :p
I forked the scrip to:
- extract the database values from wp-config.php automatically
- use domain and path for subdomain / mixed installs
- use wget instead of GET
I also dropped error logging and output because in my case I don't really need it. Thanks for an excellent starting point.
I'm glad it helped you!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for your comment and work!
In my personal situation, i can't make loopback requests from my frontends to themselves, so i run this bash from a different machine.
I like the way you use curl_multi_exec, but i wonder how well it would scale in a multisite network with hundreds of blogs. I wonder it with my script too :P