Skip to content

Instantly share code, notes, and snippets.

@Moqume
Forked from fcingolani/wp-cron.sh
Last active December 29, 2015 05:19
Show Gist options
  • Save Moqume/7620966 to your computer and use it in GitHub Desktop.
Save Moqume/7620966 to your computer and use it in GitHub Desktop.
Run wp-cron for a multi-site installation (accounts for path)
#!/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 CONCAT(domain,path) as url 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=`curl -s http://$domain/wp-cron.php > /dev/null`;
exit_status=$?;
if [ $exit_status != 0 ]; then
echo "ERR"
else
echo "OK"
fi
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment