WordPress per CLI updaten

Hallo, heute geht es um das automatisierte Update von WordPress.

Gerade wenn mehrere Seiten betrieben werden artet dies in Arbeit aus. Tools wie Infinite WP sind hier eine Option aber kostefrei nur beschränkt nutzbar.

#!/bin/bash

blacklist="test.santor.de test.santor.de"
rmfiles="wp-config-sample.php license.txt liesmich.html readme.html"
chmod -R g+w /var/www/*/httpdocs/*
cd /var/www

for domain in $(find . -name wp-config.php|awk -F'/' '{print $2}'|sort -u)
do
   count=$(echo $blacklist|grep $domain |wc -l)
   if [ $count -eq 0 ]; then
      echo "############################"
      echo "#  $domain"
      echo "############################"
      cd /var/www/$domain/httpdocs
      wp core update --allow-root
      wp plugin update --all --allow-root
      wp theme update --all --allow-root
      wp language core update --allow-root
      wp language plugin --all update --allow-root
      wp language theme --all update --allow-root
      for rmfile in $rmfiles; do
         if [ -f $rmfile ]; then
            rm $rmfile
         fi
      done
   fi
done
/root/scripts/wp-security.sh

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close