Created
February 10, 2017 10:03
-
-
Save kiki67100/a08485536ca97c7f798fd9f4e041b806 to your computer and use it in GitHub Desktop.
Upgrade WordPress from wp-cli
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd /data/www/vhosts || exit; | |
wp cli update --yes >> /root/cron/log-wp.txt | |
find . -type f -name 'wp-config.php'|while read line; | |
do | |
realpath=$(readlink -f $line); | |
dirname=$(dirname $realpath) | |
uid=$(stat -c '%U' "$line") | |
echo "" >> /root/cron/log-wp.txt | |
echo "-----------$dirname-------" >> /root/cron/log-wp.txt | |
echo "" >> /root/cron/log-wp.txt | |
sudo -S -u $uid bash -c "wp --allow-root --path=$dirname --no-color plugin upgrade --all" >> /root/cron/log-wp.txt | |
sudo -S -u $uid bash -c "wp --allow-root --path=$dirname --no-color core update" >> /root/cron/log-wp.txt | |
sudo -S -u $uid bash -c "wp --allow-root --path=$dirname --no-color core update-db" >> /root/cron/log-wp.txt | |
done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment