Skip to content

Instantly share code, notes, and snippets.

@jak119
Last active December 31, 2015 19:16
Show Gist options
  • Save jak119/8590aebf7a7d9cccb5a4 to your computer and use it in GitHub Desktop.
Save jak119/8590aebf7a7d9cccb5a4 to your computer and use it in GitHub Desktop.
Bash script to update WordPress
#!/bin/bash
#Write Output to Syslog for consumption by logging server
exec 1> >(logger -s -t $(basename $0)) 2>&1
#Update everything via the wp-cli tool (http://wp-cli.org/)
/usr/local/sbin/wp cli update --yes #Update the tool its self first
/usr/local/sbin/wp core upgrade --path='/var/www/html' --quiet
/usr/local/sbin/wp core update-db --path='/var/www/html' --quiet
/usr/local/sbin/wp core update-db --network --path='/var/www/html' --quiet
/usr/local/sbin/wp plugin update --all --path='/var/www/html' --quiet
/usr/local/sbin/wp theme update --all --path='/var/www/html' --quiet
#Remove unwanted files from upgrade
rm /var/www/html/readme.html
rm /var/www/html/wp-config-sample.php
#Ensure that the ownership and SELinux are happy
chown -R nginx:nginx /var/www/html/
restorecon -Rv /var/www/html/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment