Skip to content

Instantly share code, notes, and snippets.

@sorki
Last active November 16, 2017 21:13
Show Gist options
  • Save sorki/a6a28701c65cad4362e8cf43ded6fe45 to your computer and use it in GitHub Desktop.
Save sorki/a6a28701c65cad4362e8cf43ded6fe45 to your computer and use it in GitHub Desktop.
wordpress check / update with wp-cli
# for crontab. e.g.:
# 5 5 * * * /root/bin/wp_check_update
BLOG_DIR=/var/www/<INSERT_BLOG_PATH>
wp --path=$BLOG_DIR core check-update --quiet
if [ "$?" != "0" ]; then
Wordpress update required
wp --path=$BLOG_DIR core check-update
fi
BLOG_DIR=/var/www/<INSERT_BLOG_PATH>
wp --path=$BLOG_DIR core update
wp --path=$BLOG_DIR plugin update --all
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
mv wp-cli.phar ~/bin/wp
chmod +x ~/bin/wp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment