Skip to content

Instantly share code, notes, and snippets.

@rahul286
Forked from chmac/wp-cron.sh
Last active May 29, 2016 08:12
Show Gist options
  • Save rahul286/5966491 to your computer and use it in GitHub Desktop.
Save rahul286/5966491 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Script inspired by https://gist.github.com/1025598
# Script inspired by https://gist.github.com/chmac/2575823
#### WARNING ####
#### Please be careful with this script. The use of eval $(find) is dangerous.
#### If a user can upload a file called wp-config.php anywhere onto your site,
#### they can probably execute arbitrary commands via this script.
#### You have been warned. GPL, no warranty.
# Inspired by http://stackoverflow.com/questions/7586995/read-variables-from-wp-config-php
eval $(grep -e "DB_HOST" -e "DB_NAME" -e "DB_USER" -e "DB_PASSWORD" wp-config.php | awk -F"[()']" '/^define/{printf "%s=\"%s\"\n", $3, $5;}')
DOMAINS=$(mysql --silent --skip-column-names --host $DB_HOST --user $DB_USER -p$DB_PASSWORD $DB_NAME --execute "SELECT CONCAT(domain,path) FROM wp_blogs WHERE archived = '0' AND spam = '0' AND deleted = '0';")
for DOMAIN in $DOMAINS
do
wget --quiet --output-document=/dev/null http://$DOMAIN/wp-cron.php
sleep 2
done
@rahul286
Copy link
Author

  • Domain Mapping Support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment