Lazy wordpress updating using wp-cli.phar

Fed up installing updates to WordPress sites? Stick this in a cron job somewhere, and cross your fingers (a little)….

#!/bin/bash
set -x
set -e

for website in site1 site2 site3
do
   DOCROOT=/var/www/vhosts/$website/
   php wp-cli.phar --path=$DOCROOT core verify-checksums
   php wp-cli.phar --path=$DOCROOT core update
   php wp-cli.phar --path=$DOCROOT plugin update --all
done

You can download wp-cli.phar from wp-cli.org.

I’d suggest you don’t run the above as root.


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *