Skip to content

Instantly share code, notes, and snippets.

@wokamoto
Last active August 29, 2015 14:21
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 wokamoto/20232a1c55c12a0af461 to your computer and use it in GitHub Desktop.
Save wokamoto/20232a1c55c12a0af461 to your computer and use it in GitHub Desktop.
[wp-cli] wp-cli と jq で wp-cron に登録されているイベントをすべて実行する
#!/bin/sh
wp_root="/path/to/wordpress"
wp="wp --path=${wp_root}"
hooks=`${wp} cron event list --format=json | jq -r '.[] | select(.next_run_relative == "now") | .hook'`
for hook in ${hooks} ; do
echo "***** run event ${hook} *****"
${wp} cron event run ${hook}
echo ""
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment