WordPress autoupdater

install wp-cli -> http://wp-cli.org/

use this script

#!/bin/bash

updater(){
        wp core update --allow-root
        wp core update-db --allow-root
        wp plugin update --all --allow-root
        wp theme update --all --allow-root
        wp core language update --allow-root
        CGROUP=$(stat -c '%G' wp-cron.php)
        CUSER=$(stat -c '%U' wp-cron.php)
        chown $CUSER:$CGROUP ./* -Rf
}

for i in $(find /var/www/vhosts -name wp-cron.php); do
        wpdir=$(echo $i | sed -r 's/wp-cron.php//g')
        echo $wpdir
        cd $wpdir
        updater
done

Leave a Reply

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