Skip to content

Instantly share code, notes, and snippets.

@ksaylor11
Created September 11, 2018 19:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ksaylor11/55395e6e3b9c0f89e4753533d7fb4c14 to your computer and use it in GitHub Desktop.
Save ksaylor11/55395e6e3b9c0f89e4753533d7fb4c14 to your computer and use it in GitHub Desktop.
wordpress cron script
#/bin/bash
# adding some sense of time
start_time=`date +%s`
# use wp-cli to generate list of site urls
/usr/local/bin/wp site list --field=url --path=/var/www > sites.log;
url="wp-cron.php";
# read from our file and act on each line
while read p;
do
# uncomment line below for debugging
# echo "$p$url";
# need to add --delete-after in order to remove downloaded files
wget --no-cache --delete-after -q $p$url;
done < sites.log;
# let them know how long
echo run time is $(expr `date +%s` - $start_time) s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment