[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

view raw
wp_cron_event_run.sh
hosted with ❤ by GitHub

jq 便利すなぁ